{"thread":{"id":"8699","subject":"[PATCH] Don't ignore a low-probability ref-pack write failure","startedAt":"2007-06-24T19:13:11Z","lastAt":"2007-06-24T19:13:11Z","messageCount":1,"participants":["Jim Meyering"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"45683","messageId":"87d4zlyxmg.fsf@rho.meyering.net","threadId":"8699","inReplyTo":null,"subject":"[PATCH] Don't ignore a low-probability ref-pack write failure","fromName":"Jim Meyering","fromEmail":"jim@meyering.net","sentAt":"2007-06-24T19:13:11Z","receivedAt":"2007-06-24T19:13:11Z","isPatch":true,"sender":{"key":"jim@meyering.net","avatar":"https://avatars.githubusercontent.com/u/710630?v=4"},"body":"Without this, if the size of refs_file at that point is ever an exact\nmultiple of BUFSIZ, then an EIO or ENOSPC error on the final write would\nnot be diagnosed.\n\nIt's not worth worrying about EPIPE here.\nAlthough theoretically possible that someone kill this process\nwith a manual SIGPIPE, it's not at all likely.\n\nSigned-off-by: Jim Meyering <jim@meyering.net>\n---\n builtin-pack-refs.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/builtin-pack-refs.c b/builtin-pack-refs.c\nindex 1952950..7584992 100644\n--- a/builtin-pack-refs.c\n+++ b/builtin-pack-refs.c\n@@ -105,6 +105,8 @@ static int pack_refs(unsigned int flags)\n \tfprintf(cbdata.refs_file, \"# pack-refs with: peeled \\n\");\n\n \tfor_each_ref(handle_one_ref, &cbdata);\n+\tif (ferror(cbdata.refs_file))\n+\t\tdie(\"failed to write ref-pack file\");\n \tif (fflush(cbdata.refs_file) || fsync(fd) || fclose(cbdata.refs_file))\n \t\tdie(\"failed to write ref-pack file (%s)\", strerror(errno));\n \tif (commit_lock_file(&packed) < 0)\n"}]}