aboutsummaryrefslogtreecommitdiffstats
path: root/ftp.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2021-01-02 00:20:47 +0000
committerTatsuya Kinoshita <tats@debian.org>2021-01-02 00:20:47 +0000
commita722a562112506c63c9b6519b8252d633534a35a (patch)
tree78dc4b8bbefa910007339970eaf004f012d2082f /ftp.c
parentSwitch upstream to Debian's w3m (diff)
parentNew upstream version 0.5.3+git20210102 (diff)
downloadw3m-a722a562112506c63c9b6519b8252d633534a35a.tar.gz
w3m-a722a562112506c63c9b6519b8252d633534a35a.zip
Update upstream source from tag 'upstream/0.5.3+git20210102'
Update to upstream version '0.5.3+git20210102' with Debian dir e89c066385156d7c9ed01b0c8a1a08e01019959d
Diffstat (limited to 'ftp.c')
-rw-r--r--ftp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ftp.c b/ftp.c
index 0002abd..2ca0247 100644
--- a/ftp.c
+++ b/ftp.c
@@ -123,6 +123,7 @@ static int
ftp_login(FTP ftp)
{
int sock, status;
+ int sock_wf;
sock = openSocket(ftp->host, "ftp", 21);
if (sock < 0)
@@ -139,7 +140,6 @@ ftp_login(FTP ftp)
socklen_t socknamelen = sizeof(sockname);
if (!getsockname(sock, (struct sockaddr *)&sockname, &socknamelen)) {
- struct hostent *sockent;
Str tmp = Strnew_charp(ftp->pass);
#ifdef INET6
char hostbuf[NI_MAXHOST];
@@ -156,6 +156,7 @@ ftp_login(FTP ftp)
Strcat_charp(tmp, "unknown");
#else
+ struct hostent *sockent;
if ((sockent = gethostbyaddr((char *)&sockname.sin_addr,
sizeof(sockname.sin_addr),
sockname.sin_family)))
@@ -169,7 +170,10 @@ ftp_login(FTP ftp)
}
}
ftp->rf = newInputStream(sock);
- ftp->wf = fdopen(dup(sock), "wb");
+ if ((sock_wf = dup(sock)) >= 0 )
+ ftp->wf = fdopen(sock_wf, "wb");
+ else
+ goto open_err;
if (!ftp->rf || !ftp->wf)
goto open_err;
IStype(ftp->rf) |= IST_UNCLOSE;