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

[PATCH 2/5] fdopen_lock_file(): use fdopen_with_retry()

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Mar 5, 2015, 16:07 UTC
Message-ID
<1425571669-22800-3-git-send-email-mhagger@alum.mit.edu>
In-Reply-To
<1425571669-22800-1-git-send-email-mhagger@alum.mit.edu>
Suggested-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
Jonathan's original suggestion was that this function should call
xfdopen(). But a couple of callers of fdopen_lock_file() try to
recover if it fails, so I decided to do it this way instead.
 lockfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lockfile.c b/lockfile.c
index 9889277..cad567b 100644
--- a/lockfile.c
+++ b/lockfile.c
@@ -232,7 +232,7 @@ FILE *fdopen_lock_file(struct lock_file *lk, const char *mode)
 	if (lk->fp)
 		die("BUG: fdopen_lock_file() called twice for file '%s'", lk->filename.buf);
 
-	lk->fp = fdopen(lk->fd, mode);
+	lk->fp = fdopen_with_retry(lk->fd, mode);
 	return lk->fp;
 }
 
-- 
2.1.4
Previous: Junio C HamanoNext: Michael Haggerty
Message 5 of 13 in “Retry if fdopen() fails due to ENOMEM”
  1. 0/5 Retry if fdopen() fails due to ENOMEMMichael Haggerty, Mar 5, 2015
  2. 1/5 xfdopen(): if first attempt fails, free memory and try againMichael Haggerty, Mar 5, 2015
  3. Stefan BellerMar 5, 2015
  4. Junio C HamanoMar 5, 2015
  5. 2/5 fdopen_lock_file(): use fdopen_with_retry()Michael Haggerty, Mar 5, 2015
  6. 3/5 copy_to_log(): use fdopen_with_retry()Michael Haggerty, Mar 5, 2015
  7. 4/5 update_info_file(): use fdopen_with_retry()Michael Haggerty, Mar 5, 2015
  8. 5/5 buffer_fdinit(): use fdopen_with_retry()Michael Haggerty, Mar 5, 2015
  9. Junio C HamanoMar 5, 2015
  10. Michael HaggertyMar 10, 2015
  11. Torsten BögershausenMar 6, 2015
  12. Michael HaggertyMar 10, 2015
  13. Junio C HamanoMar 17, 2015

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.