git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] http: cast result to FILE *
@ 2019-02-01 19:30 Dan McGregor
  2019-02-01 21:17 ` Junio C Hamano
  2019-02-09  2:36 ` [PATCH v2] git-compat-util: undefine fileno if defined Dan McGregor
  0 siblings, 2 replies; 16+ messages in thread
From: Dan McGregor @ 2019-02-01 19:30 UTC (permalink / raw)
  To: git; +Cc: masayasuzuki, Dan McGregor

Commit 8dd2e88a92 ("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 <dan.mcgregor@usask.ca>
---
 http.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/http.c b/http.c
index 954bebf684..8b9476b151 100644
--- a/http.c
+++ b/http.c
@@ -1996,12 +1996,12 @@ static int http_request_reauth(const char *url,
 		strbuf_reset(result);
 		break;
 	case HTTP_REQUEST_FILE:
-		if (fflush(result)) {
+		if (fflush((FILE *)result)) {
 			error_errno("unable to flush a file");
 			return HTTP_START_FAILED;
 		}
-		rewind(result);
-		if (ftruncate(fileno(result), 0) < 0) {
+		rewind((FILE *)result);
+		if (ftruncate(fileno((FILE *)result), 0) < 0) {
 			error_errno("unable to truncate a file");
 			return HTTP_START_FAILED;
 		}
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2019-05-08 10:16 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-01 19:30 [PATCH] http: cast result to FILE * Dan McGregor
2019-02-01 21:17 ` Junio C Hamano
2019-02-02 11:21   ` Duy Nguyen
2019-02-04 11:44     ` Johannes Schindelin
2019-02-04 12:13       ` Duy Nguyen
2019-02-04 18:10         ` Junio C Hamano
2019-02-05  1:36           ` Dan McGregor
2019-02-09  2:36 ` [PATCH v2] git-compat-util: undefine fileno if defined Dan McGregor
2019-02-09 18:34   ` Junio C Hamano
2019-02-12 13:45   ` Duy Nguyen
2019-02-12 14:14     ` Duy Nguyen
2019-02-12 16:56     ` Junio C Hamano
2019-02-16  2:33     ` Dan McGregor
2019-05-08  7:46       ` Junio C Hamano
2019-05-08 10:09         ` Duy Nguyen
2019-05-08 10:16           ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).