> On 08 Sep 2016, at 23:18, Stefan Beller <sbel...@google.com> wrote: > > On Thu, Sep 8, 2016 at 11:21 AM, <larsxschnei...@gmail.com> wrote: > >> +static int packet_write_fmt_1(int fd, int gently, >> + const char *fmt, va_list args) >> +{ >> + struct strbuf buf = STRBUF_INIT; >> + size_t count; >> + >> + format_packet(&buf, fmt, args); >> + count = write_in_full(fd, buf.buf, buf.len); >> + if (count == buf.len) >> + return 0; >> + >> + if (!gently) { > > call check_pipe from write_or_die here instead of > reproducing that function?
Yes, might be better. I wasn't sure because the check_pipe is not public. Where would you declare check_pipe? In cache.h? Maybe it would be more suitable to move check_pipe to run-command.h/c? >> + if (errno == EPIPE) { >> + if (in_async()) >> + async_exit(141); >> + >> + signal(SIGPIPE, SIG_DFL); >> + raise(SIGPIPE); >> + /* Should never happen, but just in case... */ >> + exit(141); >> + } >> + die_errno("packet write error"); >> + } >> + error("packet write failed"); >> + return -1; > > I think the more idiomatic way is to > > return error(...); > > as error always return -1. Of course!! Thank you, Lars