summaryrefslogtreecommitdiff
path: root/builtin-pack-refs.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2007-06-24 21:13:11 +0200
committerJunio C Hamano <gitster@pobox.com>2007-06-26 21:49:44 -0700
commit384f122b7c6dd2b52cc6029afee16560c38850ae (patch)
tree9598c14697f8c7ce04eb2816f98e34f743c4cd5d /builtin-pack-refs.c
parent91c8d5905c33e9d7c9014a1c6c7cec8eb86584df (diff)
downloadgit-384f122b7c6dd2b52cc6029afee16560c38850ae.tar.gz
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 <jim@meyering.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-pack-refs.c')
-rw-r--r--builtin-pack-refs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin-pack-refs.c b/builtin-pack-refs.c
index 1952950c9a..758499238f 100644
--- a/builtin-pack-refs.c
+++ b/builtin-pack-refs.c
@@ -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)