diff options
Diffstat (limited to 'write_or_die.c')
-rw-r--r-- | write_or_die.c | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/write_or_die.c b/write_or_die.c index e7afe7a295..eab8c8d0b9 100644 --- a/write_or_die.c +++ b/write_or_die.c @@ -1,14 +1,5 @@ #include "cache.h" - -static void check_pipe(int err) -{ - if (err == EPIPE) { - signal(SIGPIPE, SIG_DFL); - raise(SIGPIPE); - /* Should never happen, but just in case... */ - exit(141); - } -} +#include "run-command.h" /* * Some cases use stdio, but want to flush after the write @@ -78,26 +69,3 @@ void write_or_die(int fd, const void *buf, size_t count) die_errno("write error"); } } - -int write_or_whine_pipe(int fd, const void *buf, size_t count, const char *msg) -{ - if (write_in_full(fd, buf, count) < 0) { - check_pipe(errno); - fprintf(stderr, "%s: write error (%s)\n", - msg, strerror(errno)); - return 0; - } - - return 1; -} - -int write_or_whine(int fd, const void *buf, size_t count, const char *msg) -{ - if (write_in_full(fd, buf, count) < 0) { - fprintf(stderr, "%s: write error (%s)\n", - msg, strerror(errno)); - return 0; - } - - return 1; -} |