summaryrefslogtreecommitdiffstats
path: root/usr.bin/fetch
diff options
context:
space:
mode:
authorjmg <jmg@FreeBSD.org>1997-03-06 10:01:54 +0000
committerjmg <jmg@FreeBSD.org>1997-03-06 10:01:54 +0000
commit189d91654bcf1b453f5644b76add5421384c88cb (patch)
tree92b1b30cd7571f8da4fe2453dd9652bb3af81845 /usr.bin/fetch
parentca3b19f0cda9590e432535c8965ede9aee3bf3c7 (diff)
downloadFreeBSD-src-189d91654bcf1b453f5644b76add5421384c88cb.zip
FreeBSD-src-189d91654bcf1b453f5644b76add5421384c88cb.tar.gz
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
Diffstat (limited to 'usr.bin/fetch')
-rw-r--r--usr.bin/fetch/ftp.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/fetch/ftp.c b/usr.bin/fetch/ftp.c
index aafc0e5..a74cb2d 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;
}
OpenPOWER on IntegriCloud