* fix skipping of leading / in dir, which may have resulted in

parsing junk memory (picked up whilst porting to solaris)
* remove superfluous var assignments
This commit is contained in:
lukem 1998-08-08 04:40:50 +00:00
parent 6a9c077701
commit 07a9ebee13
1 changed files with 5 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fetch.c,v 1.32 1998/08/08 04:04:17 lukem Exp $ */
/* $NetBSD: fetch.c,v 1.33 1998/08/08 04:40:50 lukem Exp $ */
/*-
* Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fetch.c,v 1.32 1998/08/08 04:04:17 lukem Exp $");
__RCSID("$NetBSD: fetch.c,v 1.33 1998/08/08 04:40:50 lukem Exp $");
#endif /* not lint */
/*
@ -732,7 +732,6 @@ auto_fetch(argc, argv, outfile)
ftpproxy = getenv(FTP_PROXY);
httpproxy = getenv(HTTP_PROXY);
host = path = dir = file = user = pass = NULL;
/*
* Loop through as long as there's files to fetch.
@ -811,18 +810,13 @@ auto_fetch(argc, argv, outfile)
break;
}
/*
* If dir is NULL, the file wasn't specified
* (URL looked something like ftp://host)
*/
dir = path;
if (dir != NULL)
*dir++ = '\0';
/*
* Extract the file and (if present) directory name.
*/
dir = path;
if (! EMPTYSTRING(dir)) {
if (*dir == '/')
dir++; /* skip leading / */
cp = strrchr(dir, '/');
if (cp != NULL) {
*cp++ = '\0';