diff options
author | jkh <jkh@FreeBSD.org> | 2000-09-19 07:45:08 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 2000-09-19 07:45:08 +0000 |
commit | 07a1e70e3d1a3989a22806f2f2549f119e43b6d4 (patch) | |
tree | 1e475911d7f55f2cc447a102ead1c7e98edf427b | |
parent | 222e32bc4941211d514ad22676414f71c1360b50 (diff) | |
download | FreeBSD-src-07a1e70e3d1a3989a22806f2f2549f119e43b6d4.zip FreeBSD-src-07a1e70e3d1a3989a22806f2f2549f119e43b6d4.tar.gz |
Simplify the ftp directory search code a little and eliminate a warning.
-rw-r--r-- | release/sysinstall/ftp.c | 10 | ||||
-rw-r--r-- | 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, "/"); } /* |