projects
/
paraslash.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Always check the return value of mark_fd_nonblocking().
[paraslash.git]
/
http_recv.c
diff --git
a/http_recv.c
b/http_recv.c
index 63b66d12610831ce06d362c4a533b9bc3a53e643..cb79b6436e1669a8725904b75355ef968d7dc23c 100644
(file)
--- a/
http_recv.c
+++ b/
http_recv.c
@@
-168,16
+168,20
@@
static int http_recv_open(struct receiver_node *rn)
{
struct private_http_recv_data *phd;
struct http_recv_args_info *conf = rn->conf;
{
struct private_http_recv_data *phd;
struct http_recv_args_info *conf = rn->conf;
- int ret = makesock(AF_UNSPEC, IPPROTO_TCP, 0, conf->host_arg, conf->port_arg);
+ int fd, ret = makesock(AF_UNSPEC, IPPROTO_TCP, 0, conf->host_arg,
+ conf->port_arg);
if (ret < 0)
return ret;
if (ret < 0)
return ret;
-
+ fd = ret;
+ ret = mark_fd_nonblocking(fd);
+ if (ret < 0) {
+ close(fd);
+ return ret;
+ }
rn->buf = para_calloc(BUFSIZE);
rn->private_data = phd = para_calloc(sizeof(struct private_http_recv_data));
rn->buf = para_calloc(BUFSIZE);
rn->private_data = phd = para_calloc(sizeof(struct private_http_recv_data));
-
- phd->fd = ret;
- mark_fd_nonblocking(phd->fd);
+ phd->fd = fd;
phd->status = HTTP_CONNECTED;
return 1;
}
phd->status = HTTP_CONNECTED;
return 1;
}