Re: [PATCH v9 09/14] pkt-line: add packet_write_gently()

2016-10-06 Thread Junio C Hamano
Lars Schneider writes: > You are right. Would the solution below be acceptable? > I would like to keep the `packet_size` variable as it eases the rest > of the function. > > > const size_t packet_size = size + 4; > > - if (packet_size > sizeof(packet_write_buffer)) > + if (size

Re: [PATCH v9 09/14] pkt-line: add packet_write_gently()

2016-10-05 Thread Lars Schneider
> On 04 Oct 2016, at 21:33, Junio C Hamano wrote: > > larsxschnei...@gmail.com writes: > >> From: Lars Schneider >> >> >> +static int packet_write_gently(const int fd_out, const char *buf, size_t >> size) >> +{ >> +static char packet_write_buffer[LARGE_PACKET_MAX]; >> +const size_t

Re: [PATCH v9 09/14] pkt-line: add packet_write_gently()

2016-10-04 Thread Junio C Hamano
larsxschnei...@gmail.com writes: > From: Lars Schneider > > packet_write_fmt_gently() uses format_packet() which lets the caller > only send string data via "%s". That means it cannot be used for > arbitrary data that may contain NULs. > > Add packet_write_gently() which writes arbitrary data and

[PATCH v9 09/14] pkt-line: add packet_write_gently()

2016-10-04 Thread larsxschneider
From: Lars Schneider packet_write_fmt_gently() uses format_packet() which lets the caller only send string data via "%s". That means it cannot be used for arbitrary data that may contain NULs. Add packet_write_gently() which writes arbitrary data and does not die in case of an error. The functio