diff options
author | John-Mark Gurney <jmg@FreeBSD.org> | 1997-03-06 10:01:54 +0000 |
---|---|---|
committer | John-Mark Gurney <jmg@FreeBSD.org> | 1997-03-06 10:01:54 +0000 |
commit | c1599df8b3dd83884511d803b8e9a3f310f6e27c (patch) | |
tree | 7aee19f2d66d792d964631cc567d24824ba79332 /usr.bin/fetch | |
parent | 643c3932d7704f1ff0935893b97643580c6f3e96 (diff) | |
download | src-c1599df8b3dd83884511d803b8e9a3f310f6e27c.tar.gz src-c1599df8b3dd83884511d803b8e9a3f310f6e27c.zip |
fix a couple problems with fetch:
. don't try to interpet a colon in the pathname as a port number
. don't report an errno message when one don't exist
Notes
Notes:
svn path=/head/; revision=23441
Diffstat (limited to 'usr.bin/fetch')
-rw-r--r-- | usr.bin/fetch/ftp.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/fetch/ftp.c b/usr.bin/fetch/ftp.c index aafc0e55da5d..a74cb2d57088 100644 --- a/usr.bin/fetch/ftp.c +++ b/usr.bin/fetch/ftp.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ftp.c,v 1.3 1997/02/10 18:49:40 wollman Exp $ + * $Id: ftp.c,v 1.4 1997/03/05 18:57:16 fenner Exp $ */ #include <sys/types.h> @@ -95,7 +95,7 @@ ftp_parse(struct fetch_state *fs, const char *uri) strncat(hostname, p, q - p); p = slash; - if (colon && colon + 1 != slash) { + if (colon && colon < slash && colon + 1 != slash) { unsigned long ul; char *ep; @@ -103,7 +103,10 @@ ftp_parse(struct fetch_state *fs, const char *uri) ul = strtoul(colon + 1, &ep, 10); if (ep != slash || ep == colon + 1 || errno != 0 || ul < 1 || ul > 65534) { - warn("`%s': invalid port in URL", uri); + if (errno) + warn("`%s': invalid port in URL", uri); + else + warnx("`%s': invalid port in URL", uri); return EX_USAGE; } |