diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-10-23 07:37:21 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-10-23 07:37:22 +0200 |
commit | 96c6bb566ee5354a1b07530a94d3f85055e46032 (patch) | |
tree | 675b4ea93a5c4ffd9db000608d23a794f6cf7d4e /transport-helper.c | |
parent | Merge branch 'rj/no-sign-compare' into maint (diff) | |
parent | read_pack_header: handle signed/unsigned comparison in read result (diff) | |
download | git-96c6bb566ee5354a1b07530a94d3f85055e46032.tar.xz git-96c6bb566ee5354a1b07530a94d3f85055e46032.zip |
Merge branch 'jk/write-in-full-fix' into maint
Many codepaths did not diagnose write failures correctly when disks
go full, due to their misuse of write_in_full() helper function,
which have been corrected.
* jk/write-in-full-fix:
read_pack_header: handle signed/unsigned comparison in read result
config: flip return value of store_write_*()
notes-merge: use ssize_t for write_in_full() return value
pkt-line: check write_in_full() errors against "< 0"
convert less-trivial versions of "write_in_full() != len"
avoid "write_in_full(fd, buf, len) != len" pattern
get-tar-commit-id: check write_in_full() return against 0
config: avoid "write_in_full(fd, buf, len) < len" pattern
Diffstat (limited to 'transport-helper.c')
-rw-r--r-- | transport-helper.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/transport-helper.c b/transport-helper.c index 2b830b2290..a72ed18efb 100644 --- a/transport-helper.c +++ b/transport-helper.c @@ -44,8 +44,7 @@ static void sendline(struct helper_data *helper, struct strbuf *buffer) { if (debug) fprintf(stderr, "Debug: Remote helper: -> %s", buffer->buf); - if (write_in_full(helper->helper->in, buffer->buf, buffer->len) - != buffer->len) + if (write_in_full(helper->helper->in, buffer->buf, buffer->len) < 0) die_errno("Full write to remote helper failed"); } @@ -74,7 +73,7 @@ static void write_constant(int fd, const char *str) { if (debug) fprintf(stderr, "Debug: Remote helper: -> %s", str); - if (write_in_full(fd, str, strlen(str)) != strlen(str)) + if (write_in_full(fd, str, strlen(str)) < 0) die_errno("Full write to remote helper failed"); } |