[PATCH 1/2] prefer xwrite instead of write

2014-01-17 Thread Erik Faye-Lund
Our xwrite wrapper already deals with a few potential hazards, and are as such more robust. Prefer it instead of write to get the robustness benefits everywhere. Signed-off-by: Erik Faye-Lund kusmab...@gmail.com --- With this patch, we don't call write directly any more; all calls goes via the

Re: [PATCH 1/2] prefer xwrite instead of write

2014-01-17 Thread Jonathan Nieder
Hi, Erik Faye-Lund wrote: --- a/builtin/merge.c +++ b/builtin/merge.c @@ -367,7 +367,7 @@ static void squash_message(struct commit *commit, struct commit_list *remotehead sha1_to_hex(commit-object.sha1)); pretty_print_commit(ctx, commit, out); }

Re: [PATCH 1/2] prefer xwrite instead of write

2014-01-17 Thread Junio C Hamano
Jonathan Nieder jrnie...@gmail.com writes: Hi, Erik Faye-Lund wrote: --- a/builtin/merge.c +++ b/builtin/merge.c @@ -367,7 +367,7 @@ static void squash_message(struct commit *commit, struct commit_list *remotehead sha1_to_hex(commit-object.sha1));

Re: [PATCH 1/2] prefer xwrite instead of write

2014-01-17 Thread Erik Faye-Lund
On Fri, Jan 17, 2014 at 8:07 PM, Junio C Hamano gits...@pobox.com wrote: Jonathan Nieder jrnie...@gmail.com writes: Hi, Erik Faye-Lund wrote: --- a/builtin/merge.c +++ b/builtin/merge.c @@ -367,7 +367,7 @@ static void squash_message(struct commit *commit, struct commit_list *remotehead

Re: [PATCH 1/2] prefer xwrite instead of write

2014-01-17 Thread Junio C Hamano
Jonathan Nieder jrnie...@gmail.com writes: Junio C Hamano wrote: Jonathan Nieder jrnie...@gmail.com writes: Shouldn't this use write_in_full() to avoid a silently truncated result? (*) Meaning this? If so, I think it makes sense. [...] -if (xwrite(fd, out.buf, out.len) 0) +if

Re: [PATCH 1/2] prefer xwrite instead of write

2014-01-17 Thread Jonathan Nieder
Junio C Hamano wrote: Jonathan Nieder jrnie...@gmail.com writes: Shouldn't this use write_in_full() to avoid a silently truncated result? (*) Meaning this? If so, I think it makes sense. [...] - if (xwrite(fd, out.buf, out.len) 0) + if (write_in_full(fd, out.buf, out.len) !=