diff options
author | jkh <jkh@FreeBSD.org> | 1997-10-01 07:21:41 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 1997-10-01 07:21:41 +0000 |
commit | 1d6b861d989cb70c251bb94feb17990bc9131627 (patch) | |
tree | f09f47e0995cd4300eb0a761f246d494090d02e6 /lib/libftpio | |
parent | 350fc0457c877fddb60b6711c9adecdf664818f1 (diff) | |
download | FreeBSD-src-1d6b861d989cb70c251bb94feb17990bc9131627.zip FreeBSD-src-1d6b861d989cb70c251bb94feb17990bc9131627.tar.gz |
Correct an ancient bogon which involved trying to read() from a
nuked file descriptor. This is probably why sysinstall's ftp xfer
occasionally SEGV'd if you left things alone for a long time and
the timeout code got called. Whoops!
Diffstat (limited to 'lib/libftpio')
-rw-r--r-- | lib/libftpio/ftpio.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/lib/libftpio/ftpio.c b/lib/libftpio/ftpio.c index 5287477..6ba853e 100644 --- a/lib/libftpio/ftpio.c +++ b/lib/libftpio/ftpio.c @@ -14,7 +14,7 @@ * Turned inside out. Now returns xfers as new file ids, not as a special * `state' of FTP_t * - * $Id: ftpio.c,v 1.25 1997/02/22 15:06:50 peter Exp $ + * $Id: ftpio.c,v 1.26 1997/09/18 14:01:15 phk Exp $ * */ @@ -607,8 +607,9 @@ get_a_number(FTP_t ftp, char **q) static int ftp_close(FTP_t ftp) { - int i; + int i, rcode; + rcode = FAILURE; if (ftp->con_state == isopen) { ftp->con_state = quit; /* If last operation timed out, don't try to quit - just close */ @@ -616,17 +617,14 @@ ftp_close(FTP_t ftp) i = cmd(ftp, "QUIT"); else i = FTP_QUIT_HAPPY; + if (!check_code(ftp, i, FTP_QUIT_HAPPY)) + rcode = SUCCESS; close(ftp->fd_ctrl); ftp->fd_ctrl = -1; - if (check_code(ftp, i, FTP_QUIT_HAPPY)) { - ftp->errno = i; - return FAILURE; - } - /* Debug("ftp_pkg: ftp_close() - proper shutdown"); */ - return SUCCESS; } - /* Debug("ftp_pkg: ftp_close() - improper shutdown"); */ - return FAILURE; + else if (ftp->con_state == quit) + rcode = SUCCESS; + return rcode; } static int |