Skip to content

Commit 6e578a3

Browse files
mhaggergitster
authored andcommitted
commit_packed_refs(): reimplement using fdopen_lock_file()
Signed-off-by: Michael Haggerty <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f70f056 commit 6e578a3

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

refs.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2309,16 +2309,13 @@ int commit_packed_refs(void)
23092309
if (!packed_ref_cache->lock)
23102310
die("internal error: packed-refs not locked");
23112311

2312-
out = fdopen(packed_ref_cache->lock->fd, "w");
2312+
out = fdopen_lock_file(packed_ref_cache->lock, "w");
23132313
if (!out)
23142314
die_errno("unable to fdopen packed-refs descriptor");
23152315

23162316
fprintf_or_die(out, "%s", PACKED_REFS_HEADER);
23172317
do_for_each_entry_in_dir(get_packed_ref_dir(packed_ref_cache),
23182318
0, write_packed_entry_fn, out);
2319-
if (fclose(out))
2320-
die_errno("write error");
2321-
packed_ref_cache->lock->fd = -1;
23222319

23232320
if (commit_lock_file(packed_ref_cache->lock)) {
23242321
save_errno = errno;

0 commit comments

Comments
 (0)