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
+++ 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);