projects
/
platform
/
upstream
/
libav.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5c74200
)
tcp: Check the return values from bind and accept
author
Martin Storsjö
<martin@martin.st>
Wed, 30 May 2012 14:35:05 +0000
(17:35 +0300)
committer
Martin Storsjö
<martin@martin.st>
Thu, 31 May 2012 22:56:21 +0000
(
01:56
+0300)
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/tcp.c
patch
|
blob
|
history
diff --git
a/libavformat/tcp.c
b/libavformat/tcp.c
index
37f74f6
..
e249e4e
100644
(file)
--- a/
libavformat/tcp.c
+++ b/
libavformat/tcp.c
@@
-84,8
+84,16
@@
static int tcp_open(URLContext *h, const char *uri, int flags)
if (listen_socket) {
int fd1;
ret = bind(fd, cur_ai->ai_addr, cur_ai->ai_addrlen);
+ if (ret) {
+ ret = ff_neterrno();
+ goto fail1;
+ }
listen(fd, 1);
fd1 = accept(fd, NULL, NULL);
+ if (fd1 < 0) {
+ ret = ff_neterrno();
+ goto fail1;
+ }
closesocket(fd);
fd = fd1;
ff_socket_nonblock(fd, 1);