git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Jul 27, 2021, 00:07 UTC
Message-ID
<patch-1.1-ad71faa6da-20210727T000657Z-avarab@gmail.com>

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.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 http.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/http.c b/http.c
index 8119247149..f7940f1b5e 100644
--- a/http.c
+++ b/http.c
@@ -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;
 	}
 
-- 
2.32.0.988.g1a6a4b2c5f
Message 1 of 1 in “http.c: use error_errno(), not error() after fopen() failure”
  1. http.c: use error_errno(), not error() after fopen() failureÆvar Arnfjörð Bjarmason, Jul 27, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.