From f0183cc46aa18095dea6ce4d9b52acd69836baca Mon Sep 17 00:00:00 2001 From: Brian Somers Date: Mon, 20 Aug 2001 15:01:06 +0000 Subject: [PATCH] Handle ftp_copycommand() and ftp_copyresult() potentially returning < -1. --- usr.sbin/faithd/ftp.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/usr.sbin/faithd/ftp.c b/usr.sbin/faithd/ftp.c index 037453e53a6c..851409f0a53b 100644 --- a/usr.sbin/faithd/ftp.c +++ b/usr.sbin/faithd/ftp.c @@ -120,16 +120,12 @@ ftp_relay(int ctl6, int ctl4) */ error = ftp_copycommand(ctl6, ctl4, &state); - switch (error) { - case -1: + if (error < 0) goto bad; - case 0: + else if (error == 0) { close(ctl4); close(ctl6); exit_success("terminating ftp control connection"); - /*NOTREACHED*/ - default: - break; } } if (FD_ISSET(ctl4, &readfds)) { @@ -139,16 +135,12 @@ ftp_relay(int ctl6, int ctl4) */ error = ftp_copyresult(ctl4, ctl6, state); - switch (error) { - case -1: + if (error < 0) goto bad; - case 0: + else if (error == 0) { close(ctl4); close(ctl6); exit_success("terminating ftp control connection"); - /*NOTREACHED*/ - default: - break; } } if (0 <= port4 && 0 <= port6 && FD_ISSET(port4, &readfds)) {