Display a better error message when snprintf() returns < 0
Pointed out by: bde
This commit is contained in:
parent
081f2a7ec6
commit
ce595235cb
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=82055
@ -282,7 +282,11 @@ url_get(origline, proxyenv)
|
|||||||
printf("Requesting %s (via %s)\n", 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",
|
len = snprintf(buf, sizeof(buf), "GET %s%s HTTP/1.0\r\n\r\n",
|
||||||
proxy ? "" : "/", path);
|
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");
|
warn("Writing HTTP request");
|
||||||
goto cleanup_url_get;
|
goto cleanup_url_get;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user