Skip to content

Commit

Permalink
Don't ignore a pack-refs write failure
Browse files Browse the repository at this point in the history
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 <jim@meyering.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Jim Meyering authored and Junio C Hamano committed Jun 27, 2007
1 parent 91c8d59 commit 384f122
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions builtin-pack-refs.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ static int pack_refs(unsigned int flags)
fprintf(cbdata.refs_file, "# pack-refs with: peeled \n");

for_each_ref(handle_one_ref, &cbdata);
if (ferror(cbdata.refs_file))
die("failed to write ref-pack file");
if (fflush(cbdata.refs_file) || fsync(fd) || fclose(cbdata.refs_file))
die("failed to write ref-pack file (%s)", strerror(errno));
if (commit_lock_file(&packed) < 0)
Expand Down

0 comments on commit 384f122

Please sign in to comment.