diff mbox

[FFmpeg-devel] avformat/unix: handling EOF in case of SOCK_STREAM

Message ID cc81a675-6caf-459e-2997-c0f7237e016a@vivanet.hu
State Accepted
Commit 1b45e6db22d979baa410645a1d5ab575175f1eb7
Headers show

Commit Message

Bodecs Bela March 20, 2018, 10:28 p.m. UTC
Dear All,

when recv() returns 0 in case of SOCK_STREAM type, it means EOF and with
this patch returns value accordingly.

See the original thread "[PATCH] avformat/unix: properly handling 
timeout at reading" for details.

please review this patch!

thank you in advance!

best regards,

Bela Bodecs
From 3a022da0ebd01b65fd3beed95a13ea0f0fcabb20 Mon Sep 17 00:00:00 2001
From: Bela Bodecs <bodecsb@vivanet.hu>
Date: Tue, 20 Mar 2018 23:24:11 +0100
Subject: [PATCH] avformat/unix: handling EOF in case of SOCK_STREAM

when recv() returns 0 in case of SOCK_STREAM type, it means EOF and with
this patch returns value accordingly.

Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
---
 libavformat/unix.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Nicolas George March 21, 2018, 4:36 p.m. UTC | #1
Bodecs Bela (2018-03-20):
> >From 3a022da0ebd01b65fd3beed95a13ea0f0fcabb20 Mon Sep 17 00:00:00 2001
> From: Bela Bodecs <bodecsb@vivanet.hu>
> Date: Tue, 20 Mar 2018 23:24:11 +0100
> Subject: [PATCH] avformat/unix: handling EOF in case of SOCK_STREAM
> 
> when recv() returns 0 in case of SOCK_STREAM type, it means EOF and with
> this patch returns value accordingly.
> 
> Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>

LGTM, thanks. I do not remember if you have commit rights.

Regards,
Bodecs Bela March 21, 2018, 4:42 p.m. UTC | #2
2018.03.21. 17:36 keltezéssel, Nicolas George írta:
> Bodecs Bela (2018-03-20):
>> >From 3a022da0ebd01b65fd3beed95a13ea0f0fcabb20 Mon Sep 17 00:00:00 2001
>> From: Bela Bodecs <bodecsb@vivanet.hu>
>> Date: Tue, 20 Mar 2018 23:24:11 +0100
>> Subject: [PATCH] avformat/unix: handling EOF in case of SOCK_STREAM
>>
>> when recv() returns 0 in case of SOCK_STREAM type, it means EOF and with
>> this patch returns value accordingly.
>>
>> Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu>
> LGTM, thanks. I do not remember if you have commit rights.
>
> Regards,
>
thank you, I have no commit rights.

bb


>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Nicolas George March 21, 2018, 7:10 p.m. UTC | #3
Bodecs Bela (2018-03-21):
> thank you, I have no commit rights.

Ok, pushed. Thanks for the fix.

Regards,
diff mbox

Patch

diff --git a/libavformat/unix.c b/libavformat/unix.c
index 4f01d14..38016db 100644
--- a/libavformat/unix.c
+++ b/libavformat/unix.c
@@ -111,6 +111,8 @@  static int unix_read(URLContext *h, uint8_t *buf, int size)
             return ret;
     }
     ret = recv(s->fd, buf, size, 0);
+    if (!ret && s->type == SOCK_STREAM)
+        return AVERROR_EOF;
     return ret < 0 ? ff_neterrno() : ret;
 }