Re: [PATCH v7 04/10] pkt-line: add packet_flush_gently()

2016-09-15 Thread Junio C Hamano
Lars Schneider writes: >> So the "right" pattern is either: >> >> 1. Return -1 and the caller is responsible for telling the user. >> ... which is valid only if there aren't different kinds of errors that all return -1; with "return error(...)" with different

Re: [PATCH v7 04/10] pkt-line: add packet_flush_gently()

2016-09-15 Thread Lars Schneider
> On 15 Sep 2016, at 21:44, Jeff King wrote: > > On Thu, Sep 15, 2016 at 05:42:58PM +0100, Lars Schneider wrote: > >> +int packet_flush_gently(int fd) >> +{ >> +packet_trace("", 4, 1); >> +if (write_in_full(fd, "", 4) == 4) >> +

Re: [PATCH v7 04/10] pkt-line: add packet_flush_gently()

2016-09-15 Thread Jeff King
On Thu, Sep 15, 2016 at 05:42:58PM +0100, Lars Schneider wrote: > +int packet_flush_gently(int fd) > +{ > +packet_trace("", 4, 1); > +if (write_in_full(fd, "", 4) == 4) > +return 0; > +error("flush packet write

Re: [PATCH v7 04/10] pkt-line: add packet_flush_gently()

2016-09-15 Thread Lars Schneider
> On 13 Sep 2016, at 23:44, Junio C Hamano wrote: > > Lars Schneider writes: > >>> On 13 Sep 2016, at 00:30, Junio C Hamano wrote: >>> >>> larsxschnei...@gmail.com writes: >>> From: Lars Schneider

Re: [PATCH v7 04/10] pkt-line: add packet_flush_gently()

2016-09-13 Thread Junio C Hamano
Lars Schneider writes: >> On 13 Sep 2016, at 00:30, Junio C Hamano wrote: >> >> larsxschnei...@gmail.com writes: >> >>> From: Lars Schneider >>> >>> packet_flush() would die in case of a write error even though for some

Re: [PATCH v7 04/10] pkt-line: add packet_flush_gently()

2016-09-13 Thread Lars Schneider
> On 13 Sep 2016, at 00:30, Junio C Hamano wrote: > > larsxschnei...@gmail.com writes: > >> From: Lars Schneider >> >> packet_flush() would die in case of a write error even though for some >> callers an error would be acceptable. Add

Re: [PATCH v7 04/10] pkt-line: add packet_flush_gently()

2016-09-12 Thread Junio C Hamano
larsxschnei...@gmail.com writes: > From: Lars Schneider > > packet_flush() would die in case of a write error even though for some > callers an error would be acceptable. Add packet_flush_gently() which > writes a pkt-line flush packet and returns `0` for success and

[PATCH v7 04/10] pkt-line: add packet_flush_gently()

2016-09-08 Thread larsxschneider
From: Lars Schneider packet_flush() would die in case of a write error even though for some callers an error would be acceptable. Add packet_flush_gently() which writes a pkt-line flush packet and returns `0` for success and `-1` for failure. Signed-off-by: Lars