Merge branch 'jk/write-in-full-fix' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 23 Oct 2017 05:37:21 +0000 (14:37 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 23 Oct 2017 05:37:22 +0000 (14:37 +0900)
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

1  2 
config.c
diff.c
fast-import.c
pkt-line.c
refs.c
sha1_file.c
transport-helper.c
diff --cc config.c
Simple merge
diff --cc diff.c
Simple merge
diff --cc fast-import.c
Simple merge
diff --cc pkt-line.c
index f364944b931a756b3b4819fb49ff5e9e01daf676,4823d3bb9db002fadf47124184ccea39d66fac68..647bbd3bceda71f15fdf137a37f3fa53e6fa6d86
@@@ -136,20 -136,18 +136,19 @@@ static void format_packet(struct strbu
  static int packet_write_fmt_1(int fd, int gently,
                              const char *fmt, va_list args)
  {
 -      struct strbuf buf = STRBUF_INIT;
 +      static struct strbuf buf = STRBUF_INIT;
-       ssize_t count;
  
 +      strbuf_reset(&buf);
        format_packet(&buf, fmt, args);
-       count = write_in_full(fd, buf.buf, buf.len);
-       if (count == buf.len)
-               return 0;
-       if (!gently) {
-               check_pipe(errno);
-               die_errno("packet write with format failed");
+       if (write_in_full(fd, buf.buf, buf.len) < 0) {
+               if (!gently) {
+                       check_pipe(errno);
+                       die_errno("packet write with format failed");
+               }
+               return error("packet write with format failed");
        }
-       return error("packet write with format failed");
+       return 0;
  }
  
  void packet_write_fmt(int fd, const char *fmt, ...)
diff --cc refs.c
Simple merge
diff --cc sha1_file.c
Simple merge
Simple merge