From patchwork Sat Apr 8 12:21:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Thelen X-Patchwork-Id: 3340 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.44.195 with SMTP id s186csp662738vss; Sat, 8 Apr 2017 05:21:50 -0700 (PDT) X-Received: by 10.28.45.216 with SMTP id t207mr3230419wmt.85.1491654110545; Sat, 08 Apr 2017 05:21:50 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id y21si12611776wra.109.2017.04.08.05.21.49; Sat, 08 Apr 2017 05:21:50 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8E9486883D3; Sat, 8 Apr 2017 15:21:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from synchrony.c-14.de (synchrony.c-14.de [88.99.86.234]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 0E7BE6882F8 for ; Sat, 8 Apr 2017 15:21:37 +0300 (EEST) Received: from salusa-secundus.dune (HSI-KBW-134-3-145-137.hsi14.kabel-badenwuerttemberg.de [134.3.145.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by synchrony.c-14.de (Postfix) with ESMTPSA id 52C1A60FDE for ; Sat, 8 Apr 2017 12:21:11 +0000 (UTC) From: Simon Thelen To: ffmpeg-devel@ffmpeg.org Date: Sat, 8 Apr 2017 14:21:28 +0200 Message-Id: <20170408122128.24991-1-ffmpeg-dev@c-14.de> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170408120139.22428-1-ffmpeg-dev@c-14.de> References: <20170408120139.22428-1-ffmpeg-dev@c-14.de> Subject: [FFmpeg-devel] [PATCH v2] libavformat/tcp: fix return code for tcp_accept X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" ff_accept can return AVERROR(ETIMEDOUT) and errno will be 0 (or undefined), return ret instead and return ff_neterror() in ff_poll_interrupt instead of AVERROR(errno) to parse WSAGetLastError on Windows. --- v2 rewords the commit message to better elucidate the issue. libavformat/network.c | 2 +- libavformat/tcp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/network.c b/libavformat/network.c index 2fb1c8b02a..b3987a4d11 100644 --- a/libavformat/network.c +++ b/libavformat/network.c @@ -159,7 +159,7 @@ static int ff_poll_interrupt(struct pollfd *p, nfds_t nfds, int timeout, if (!ret) return AVERROR(ETIMEDOUT); if (ret < 0) - return AVERROR(errno); + return ff_neterrno(); return ret; } diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 3055e48015..07b4ed9fa3 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -204,7 +204,7 @@ static int tcp_accept(URLContext *s, URLContext **c) cc = (*c)->priv_data; ret = ff_accept(sc->fd, sc->listen_timeout, s); if (ret < 0) - return ff_neterrno(); + return ret; cc->fd = ret; return 0; }