summaryrefslogtreecommitdiffstats
path: root/usr.bin/ftp
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>2001-08-21 11:39:45 +0000
committerbrian <brian@FreeBSD.org>2001-08-21 11:39:45 +0000
commitbe0965e41d94fb2cf2bf88e3978ff249dd16793a (patch)
treec44c661d3876f93d37f0d9da2583f7981ab89650 /usr.bin/ftp
parent30830b42926a66f348cb4d1deb534a02a428f1ed (diff)
downloadFreeBSD-src-be0965e41d94fb2cf2bf88e3978ff249dd16793a.zip
FreeBSD-src-be0965e41d94fb2cf2bf88e3978ff249dd16793a.tar.gz
Display a better error message when snprintf() returns < 0
Pointed out by: bde
Diffstat (limited to 'usr.bin/ftp')
-rw-r--r--usr.bin/ftp/fetch.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c
index 870c3ff..31d5649 100644
--- a/usr.bin/ftp/fetch.c
+++ b/usr.bin/ftp/fetch.c
@@ -282,7 +282,11 @@ url_get(origline, proxyenv)
printf("Requesting %s (via %s)\n", origline, proxyenv);
len = snprintf(buf, sizeof(buf), "GET %s%s HTTP/1.0\r\n\r\n",
proxy ? "" : "/", path);
- if (len < 0 || write(s, buf, len) < len) {
+ if (len < 0) {
+ warnx("Failed to format HTTP request");
+ goto cleanup_url_get;
+ }
+ if (write(s, buf, len) < len) {
warn("Writing HTTP request");
goto cleanup_url_get;
}
OpenPOWER on IntegriCloud