Merge branch 'sd/branch-copy'
authorJunio C Hamano <gitster@pobox.com>
Mon, 27 Nov 2017 02:06:35 +0000 (11:06 +0900)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Nov 2017 02:06:35 +0000 (11:06 +0900)
Code clean-up.

* sd/branch-copy:
config: avoid "write_in_full(fd, buf, len) != len" pattern

1  2 
config.c
diff --cc config.c
index 03ab56d3d8d55bb328572005e98539bd1e423f7e,4457aec089766710a69c45138c87e3c7c2ebd43d..731b9b1de2fa222be838c73b410b9619e234feec
+++ b/config.c
@@@ -2824,8 -2700,8 +2824,8 @@@ static int git_config_copy_or_rename_se
                         * multiple [branch "$name"] sections.
                         */
                        if (copystr.len > 0) {
-                               if (write_in_full(out_fd, copystr.buf, copystr.len) != copystr.len) {
+                               if (write_in_full(out_fd, copystr.buf, copystr.len) < 0) {
 -                                      ret = write_error(get_lock_file_path(lock));
 +                                      ret = write_error(get_lock_file_path(&lock));
                                        goto out;
                                }
                                strbuf_reset(&copystr);
         * logic in the loop above.
         */
        if (copystr.len > 0) {
-               if (write_in_full(out_fd, copystr.buf, copystr.len) != copystr.len) {
+               if (write_in_full(out_fd, copystr.buf, copystr.len) < 0) {
 -                      ret = write_error(get_lock_file_path(lock));
 +                      ret = write_error(get_lock_file_path(&lock));
                        goto out;
                }
                strbuf_reset(&copystr);