* [PATCH] Don't ignore a low-probability ref-pack write failure
@ 2007-06-24 19:13 Jim Meyering
0 siblings, 0 replies; only message in thread
From: Jim Meyering @ 2007-06-24 19:13 UTC (permalink / raw)
To: git
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>
---
builtin-pack-refs.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/builtin-pack-refs.c b/builtin-pack-refs.c
index 1952950..7584992 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)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2007-06-24 19:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-24 19:13 [PATCH] Don't ignore a low-probability ref-pack write failure Jim Meyering
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox