Check dup call for errors
This commit is contained in:
committed by
Tatsuya Kinoshita
parent
dd9d2a9752
commit
b1bf058d2a
6
news.c
6
news.c
@@ -76,13 +76,15 @@ news_close(News * news)
|
||||
static int
|
||||
news_open(News * news)
|
||||
{
|
||||
int sock, status;
|
||||
int sock, status, fd;
|
||||
|
||||
sock = openSocket(news->host, "nntp", news->port);
|
||||
if (sock < 0)
|
||||
goto open_err;
|
||||
news->rf = newInputStream(sock);
|
||||
news->wf = fdopen(dup(sock), "wb");
|
||||
if ((fd = dup(sock)) < 0)
|
||||
goto open_err;
|
||||
news->wf = fdopen(fd, "wb");
|
||||
if (!news->rf || !news->wf)
|
||||
goto open_err;
|
||||
IStype(news->rf) |= IST_UNCLOSE;
|
||||
|
Reference in New Issue
Block a user