Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Anton Khirnov <anton@khirnov.net>
To: ffmpeg-devel@ffmpeg.org
Subject: [FFmpeg-devel] [PATCH 4/4] lavf/network: log ff_listen() errors to proper contexts rather than NULL
Date: Mon, 10 Jan 2022 17:51:44 +0100
Message-ID: <20220110165143.2292-4-anton@khirnov.net> (raw)
In-Reply-To: <20220110165143.2292-1-anton@khirnov.net>

---
 libavformat/network.c | 6 +++---
 libavformat/network.h | 3 ++-
 libavformat/tcp.c     | 2 +-
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/network.c b/libavformat/network.c
index c3d9f82551..246ffd406d 100644
--- a/libavformat/network.c
+++ b/libavformat/network.c
@@ -208,12 +208,12 @@ int ff_socket(int af, int type, int proto, void *logctx)
 }
 
 int ff_listen(int fd, const struct sockaddr *addr,
-              socklen_t addrlen)
+              socklen_t addrlen, void *logctx)
 {
     int ret;
     int reuse = 1;
     if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &reuse, sizeof(reuse))) {
-        av_log(NULL, AV_LOG_WARNING, "setsockopt(SO_REUSEADDR) failed\n");
+        av_log(logctx, AV_LOG_WARNING, "setsockopt(SO_REUSEADDR) failed\n");
     }
     ret = bind(fd, addr, addrlen);
     if (ret)
@@ -247,7 +247,7 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
                    socklen_t addrlen, int timeout, URLContext *h)
 {
     int ret;
-    if ((ret = ff_listen(fd, addr, addrlen)) < 0)
+    if ((ret = ff_listen(fd, addr, addrlen, h)) < 0)
         return ret;
     if ((ret = ff_accept(fd, timeout, h)) < 0)
         return ret;
diff --git a/libavformat/network.h b/libavformat/network.h
index d76166faf6..71c49a73fb 100644
--- a/libavformat/network.h
+++ b/libavformat/network.h
@@ -271,7 +271,8 @@ int ff_listen_bind(int fd, const struct sockaddr *addr,
  * @param addrlen Third argument of bind().
  * @return        0 on success or an AVERROR on failure.
  */
-int ff_listen(int fd, const struct sockaddr *addr, socklen_t addrlen);
+int ff_listen(int fd, const struct sockaddr *addr, socklen_t addrlen,
+              void *logctx);
 
 /**
  * Poll for a single connection on the passed file descriptor.
diff --git a/libavformat/tcp.c b/libavformat/tcp.c
index 84d40a1e11..a11ccbb913 100644
--- a/libavformat/tcp.c
+++ b/libavformat/tcp.c
@@ -188,7 +188,7 @@ static int tcp_open(URLContext *h, const char *uri, int flags)
 
     if (s->listen == 2) {
         // multi-client
-        if ((ret = ff_listen(fd, cur_ai->ai_addr, cur_ai->ai_addrlen)) < 0)
+        if ((ret = ff_listen(fd, cur_ai->ai_addr, cur_ai->ai_addrlen, h)) < 0)
             goto fail1;
     } else if (s->listen == 1) {
         // single client
-- 
2.33.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2022-01-10 16:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-10 16:51 [FFmpeg-devel] [PATCH 1/4] lavf/udp: do not return an uninitialized value from udp_open() Anton Khirnov
2022-01-10 16:51 ` [FFmpeg-devel] [PATCH 2/4] lavf/udp: log net errors to proper contexts rather than NULL Anton Khirnov
2022-01-10 16:51 ` [FFmpeg-devel] [PATCH 3/4] lavf/network: log ff_socket() " Anton Khirnov
2022-01-10 16:51 ` Anton Khirnov [this message]
2022-01-10 17:51 ` [FFmpeg-devel] [PATCH 1/4] lavf/udp: do not return an uninitialized value from udp_open() James Almer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220110165143.2292-4-anton@khirnov.net \
    --to=anton@khirnov.net \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git