#if HAVE_POLL_H
#include <poll.h>
#endif
-#include <sys/time.h>
typedef struct TCPContext {
int fd;
ret = ff_neterrno();
goto fail1;
}
- listen(fd, 1);
+ ret = listen(fd, 1);
+ if (ret) {
+ ret = ff_neterrno();
+ goto fail1;
+ }
fd1 = accept(fd, NULL, NULL);
if (fd1 < 0) {
ret = ff_neterrno();
}
/* test error */
optlen = sizeof(ret);
- getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen);
+ if (getsockopt (fd, SOL_SOCKET, SO_ERROR, &ret, &optlen))
+ ret = AVUNERROR(ff_neterrno());
if (ret != 0) {
+ char errbuf[100];
+ ret = AVERROR(ret);
+ av_strerror(ret, errbuf, sizeof(errbuf));
av_log(h, AV_LOG_ERROR,
"TCP connection to %s:%d failed: %s\n",
- hostname, port, strerror(ret));
- ret = AVERROR(ret);
+ hostname, port, errbuf);
goto fail;
}
}