aboutsummaryrefslogtreecommitdiffstats
path: root/news.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2021-01-02 00:20:37 +0000
committerTatsuya Kinoshita <tats@debian.org>2021-01-02 00:20:37 +0000
commit1d0ba25a660483da1272a31dd077ed94441e3d9f (patch)
tree1d8dee52cd1e3d340fe178a8193dc96c4496db84 /news.c
parentMerge branch 'cvstrunk' into upstream (diff)
downloadw3m-upstream.tar.gz
w3m-upstream.zip
New upstream version 0.5.3+git20210102upstream/0.5.3+git20210102upstream
Diffstat (limited to 'news.c')
-rw-r--r--news.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/news.c b/news.c
index 8a1f0e8..c0494b7 100644
--- a/news.c
+++ b/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;