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>
This commit is contained in:
Nguyễn Thái Ngọc Duy 2016-05-08 16:47:48 +07:00 committed by Junio C Hamano
parent 7645d8f119
commit d2e255eefa

10
http.c
View File

@ -446,8 +446,7 @@ static int sockopt_callback(void *client, curl_socket_t fd, curlsocktype type)
rc = setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&ka, len); rc = setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (void *)&ka, len);
if (rc < 0) if (rc < 0)
warning("unable to set SO_KEEPALIVE on socket %s", warning_errno("unable to set SO_KEEPALIVE on socket");
strerror(errno));
return 0; /* CURL_SOCKOPT_OK only exists since curl 7.21.5 */ return 0; /* CURL_SOCKOPT_OK only exists since curl 7.21.5 */
} }
@ -1891,8 +1890,7 @@ struct http_object_request *new_http_object_request(const char *base_url,
} }
if (freq->localfile < 0) { if (freq->localfile < 0) {
error("Couldn't create temporary file %s: %s", error_errno("Couldn't create temporary file %s", freq->tmpfile);
freq->tmpfile, strerror(errno));
goto abort; goto abort;
} }
@ -1937,8 +1935,8 @@ struct http_object_request *new_http_object_request(const char *base_url,
prev_posn = 0; prev_posn = 0;
lseek(freq->localfile, 0, SEEK_SET); lseek(freq->localfile, 0, SEEK_SET);
if (ftruncate(freq->localfile, 0) < 0) { if (ftruncate(freq->localfile, 0) < 0) {
error("Couldn't truncate temporary file %s: %s", error_errno("Couldn't truncate temporary file %s",
freq->tmpfile, strerror(errno)); freq->tmpfile);
goto abort; goto abort;
} }
} }