Skip to contentSkip to conversation

http.c: use error_errno(), not error() after fopen() failure

PATCH New Ævar Arnfjörð Bjarmason 1 participant 1 message Jul 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 http.c: use error_errno(), not error() after fopen() failure

Improve the error reporting added in e929cd20bb3 (http.c: new functions for the http API, 2009-06-06) to emit strerror(), as fopen() is a failing system call we'll have a meaningful errno to report.

---
 http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
http.c +2 -2
index 8119247149..f7940f1b5e 100644
@@ -2341,8 +2341,8 @@ struct http_pack_request *new_direct_http_pack_request(
 	strbuf_addf(&preq->tmpfile, "%s.temp", sha1_pack_name(packed_git_hash));
 	preq->packfile = fopen(preq->tmpfile.buf, "a");
 	if (!preq->packfile) {
-		error("Unable to open local file %s for pack",
-		      preq->tmpfile.buf);
+		error_errno("Unable to open local file %s for pack",
+			    preq->tmpfile.buf);
 		goto abort;
 	}
 
Signature · 1 line
2.32.0.988.g1a6a4b2c5f