From 07a1e70e3d1a3989a22806f2f2549f119e43b6d4 Mon Sep 17 00:00:00 2001 From: jkh Date: Tue, 19 Sep 2000 07:45:08 +0000 Subject: Simplify the ftp directory search code a little and eliminate a warning. --- release/sysinstall/ftp.c | 10 ++++------ usr.sbin/sysinstall/ftp.c | 10 ++++------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/release/sysinstall/ftp.c b/release/sysinstall/ftp.c index f83367e..b9cb0dc 100644 --- a/release/sysinstall/ftp.c +++ b/release/sysinstall/ftp.c @@ -162,17 +162,15 @@ try: * rel. If it succeeds we break out. If it fails, then we go back to * the base directory and try again. Lots of chdirs, but oh well. :) */ - fdir = 0; - while (ftp_dirs[fdir] != NULL) { - if (ftpChdir(OpenConn, ftp_dirs[fdir++]) != 0) + for (fdir = 0; ftp_dirs[fdir]; fdir++) { + if (ftpChdir(OpenConn, (char *)ftp_dirs[fdir]) != 0) continue; if (ftpChdir(OpenConn, rel) == 0) { ftpInitted = TRUE; return TRUE; } - ftpChdir(OpenConn, "/"); - if (dir && *dir != '\0') - ftpChdir(OpenConn, dir); + else /* reset to "root" dir for a fresh try */ + ftpChdir(OpenConn, "/"); } /* diff --git a/usr.sbin/sysinstall/ftp.c b/usr.sbin/sysinstall/ftp.c index f83367e..b9cb0dc 100644 --- a/usr.sbin/sysinstall/ftp.c +++ b/usr.sbin/sysinstall/ftp.c @@ -162,17 +162,15 @@ try: * rel. If it succeeds we break out. If it fails, then we go back to * the base directory and try again. Lots of chdirs, but oh well. :) */ - fdir = 0; - while (ftp_dirs[fdir] != NULL) { - if (ftpChdir(OpenConn, ftp_dirs[fdir++]) != 0) + for (fdir = 0; ftp_dirs[fdir]; fdir++) { + if (ftpChdir(OpenConn, (char *)ftp_dirs[fdir]) != 0) continue; if (ftpChdir(OpenConn, rel) == 0) { ftpInitted = TRUE; return TRUE; } - ftpChdir(OpenConn, "/"); - if (dir && *dir != '\0') - ftpChdir(OpenConn, dir); + else /* reset to "root" dir for a fresh try */ + ftpChdir(OpenConn, "/"); } /* -- cgit v1.1