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

[PATCH 3/3] commit_packed_refs(): reimplement using fdopen_lock_file()

From
Michael Haggerty <mhagger@alum.mit.edu>
Date
Oct 1, 2014, 11:14 UTC
Message-ID
<1412162089-3233-4-git-send-email-mhagger@alum.mit.edu>
In-Reply-To
<1412162089-3233-1-git-send-email-mhagger@alum.mit.edu>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
---
 refs.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/refs.c b/refs.c
index 1d73f1d..a77458f 100644
--- a/refs.c
+++ b/refs.c
@@ -2309,16 +2309,13 @@ int commit_packed_refs(void)
 	if (!packed_ref_cache->lock)
 		die("internal error: packed-refs not locked");
 
-	out = fdopen(packed_ref_cache->lock->fd, "w");
+	out = fdopen_lock_file(packed_ref_cache->lock, "w");
 	if (!out)
 		die_errno("unable to fdopen packed-refs descriptor");
 
 	fprintf_or_die(out, "%s", PACKED_REFS_HEADER);
 	do_for_each_entry_in_dir(get_packed_ref_dir(packed_ref_cache),
 				 0, write_packed_entry_fn, out);
-	if (fclose(out))
-		die_errno("write error");
-	packed_ref_cache->lock->fd = -1;
 
 	if (commit_lock_file(packed_ref_cache->lock)) {
 		save_errno = errno;
-- 
2.1.0
Previous: Michael HaggertyNext: Jeff King
Message 8 of 9 in “Support stdio access to lockfiles”
  1. 0/3 Support stdio access to lockfilesMichael Haggerty, Oct 1, 2014
  2. 1/3 fdopen_lock_file(): access a lockfile using stdioMichael Haggerty, Oct 1, 2014
  3. Jeff KingOct 1, 2014
  4. Junio C HamanoOct 1, 2014
  5. Torsten BögershausenOct 2, 2014
  6. Michael HaggertyOct 12, 2014
  7. 2/3 dump_marks(): reimplement using fdopen_lock_file()Michael Haggerty, Oct 1, 2014
  8. 3/3 commit_packed_refs(): reimplement using fdopen_lock_file()Michael Haggerty, Oct 1, 2014
  9. Jeff KingOct 1, 2014

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.