Skip to content

Commit ba81921

Browse files
dankmgitster
authored andcommitted
http: cast result to FILE *
Commit 8dd2e88 ("http: support file handles for HTTP_KEEP_ERROR", 2019-01-10) introduced an implicit assumption that rewind, fileno, and fflush are functions. At least on FreeBSD fileno is not, and as such passing a void * failed. Explicitly cast result to a FILE * when using standard functions that may ultimately be macros. Signed-off-by: Dan McGregor <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b5101f9 commit ba81921

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

http.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1996,12 +1996,12 @@ static int http_request_reauth(const char *url,
19961996
strbuf_reset(result);
19971997
break;
19981998
case HTTP_REQUEST_FILE:
1999-
if (fflush(result)) {
1999+
if (fflush((FILE *)result)) {
20002000
error_errno("unable to flush a file");
20012001
return HTTP_START_FAILED;
20022002
}
2003-
rewind(result);
2004-
if (ftruncate(fileno(result), 0) < 0) {
2003+
rewind((FILE *)result);
2004+
if (ftruncate(fileno((FILE *)result), 0) < 0) {
20052005
error_errno("unable to truncate a file");
20062006
return HTTP_START_FAILED;
20072007
}

0 commit comments

Comments
 (0)