@matheusbsbs / matheus-bagliano / commits / 384f122b7c
Fork 0

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>

Jim Meyering committed Jun 24, 2007 at 21:13 UTC 384f122b7c6dd2b52cc6029afee16560c38850ae
1 file changed +2
builtin-pack-refs.c
+2
@@ -105,6 +105,8 @@ static int pack_refs(unsigned int flags)
105 fprintf(cbdata.refs_file, "# pack-refs with: peeled \n");
106
107 for_each_ref(handle_one_ref, &cbdata);
108 + if (ferror(cbdata.refs_file))
109 + die("failed to write ref-pack file");
110 if (fflush(cbdata.refs_file) || fsync(fd) || fclose(cbdata.refs_file))
111 die("failed to write ref-pack file (%s)", strerror(errno));
112 if (commit_lock_file(&packed) < 0)