Skip to content

Commit 384f122

Browse files
meyeringgitster
authored andcommitted
Don't ignore a pack-refs write failure
Without this, if the size of refs_file at that point is ever an exact multiple of BUFSIZ, then an EIO or ENOSPC error on the final write would not be diagnosed. It's not worth worrying about EPIPE here. Although theoretically possible that someone kill this process with a manual SIGPIPE, it's not at all likely. Signed-off-by: Jim Meyering <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 91c8d59 commit 384f122

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin-pack-refs.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ static int pack_refs(unsigned int flags)
105105
fprintf(cbdata.refs_file, "# pack-refs with: peeled \n");
106106

107107
for_each_ref(handle_one_ref, &cbdata);
108+
if (ferror(cbdata.refs_file))
109+
die("failed to write ref-pack file");
108110
if (fflush(cbdata.refs_file) || fsync(fd) || fclose(cbdata.refs_file))
109111
die("failed to write ref-pack file (%s)", strerror(errno));
110112
if (commit_lock_file(&packed) < 0)

0 commit comments

Comments
 (0)