http.c: use error_errno() and warning_errno()
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
May 8, 2016 at 16:47 UTC
d2e255eefab204fa6585963d5670b6cffdee866e
1 file changed
+4
-6
http.c
+4
-6
@@ -446,8 +446,7 @@ static int sockopt_callback(void *client, curl_socket_t fd, curlsocktype type)
446
447
rc = setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&ka, len);
448
if (rc < 0)
449
- warning("unable to set SO_KEEPALIVE on socket %s",
450
- strerror(errno));
449
+ warning_errno("unable to set SO_KEEPALIVE on socket");
450
451
return 0; /* CURL_SOCKOPT_OK only exists since curl 7.21.5 */
452
}
@@ -1891,8 +1890,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
1890
}
1891
1892
if (freq->localfile < 0) {
1894
- error("Couldn't create temporary file %s: %s",
1895
- freq->tmpfile, strerror(errno));
1893
+ error_errno("Couldn't create temporary file %s", freq->tmpfile);
1894
goto abort;
1895
}
1896
@@ -1937,8 +1935,8 @@ struct http_object_request *new_http_object_request(const char *base_url,
1935
prev_posn = 0;
1936
lseek(freq->localfile, 0, SEEK_SET);
1937
if (ftruncate(freq->localfile, 0) < 0) {
1940
- error("Couldn't truncate temporary file %s: %s",
1941
- freq->tmpfile, strerror(errno));
1938
+ error_errno("Couldn't truncate temporary file %s",
1939
+ freq->tmpfile);
1940
goto abort;
1941
}
1942
}