From: millert Date: Wed, 29 Jan 1997 22:21:32 +0000 (+0000) Subject: Break out of infinite loop ftp://home.host/som/path mode if host X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=459ec21e2ab5ad62aaa543b1255fa18cd2090755;p=openbsd Break out of infinite loop ftp://home.host/som/path mode if host does not exist. Also, use herror, not perror if gethostbynam() fails. --- diff --git a/usr.bin/ftp/http.c b/usr.bin/ftp/http.c index 36be1d9bdd1..69642d7a825 100644 --- a/usr.bin/ftp/http.c +++ b/usr.bin/ftp/http.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http.c,v 1.1 1996/09/03 18:00:06 deraadt Exp $ */ +/* $OpenBSD: http.c,v 1.2 1997/01/29 22:21:32 millert Exp $ */ /* * Copyright (c) 1996 Theo de Raadt @@ -104,7 +104,7 @@ http_fetch(url) he = gethostbyname(hostname); if (!he) { - perror("gethostbyname"); + herror("gethostbyname"); goto die; } diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c index 44cd8e43611..a10adcc5303 100644 --- a/usr.bin/ftp/main.c +++ b/usr.bin/ftp/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.15 1997/01/25 21:42:33 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.16 1997/01/29 22:21:32 millert Exp $ */ /* * Copyright (c) 1985, 1989, 1993, 1994 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.15 1997/01/25 21:42:33 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.16 1997/01/29 22:21:32 millert Exp $"; #endif #endif /* not lint */ @@ -213,6 +213,8 @@ main(argc, argv) if (!connected) { printf("failed to connect to %s\n", host); ret = 1; + argc--; + argv++; goto bail; } *argv = p + 1;