files-backend: prefer "0" for write_in_full() error check
Commit 06f46f237a (avoid "write_in_full(fd, buf, len) != len" pattern, 2017-09-13) converted this callsite from: write_in_full(...) != 1 to write_in_full(...) < 0 But during the conflict resolution in c50424a6f0 (Merge branch 'jk/write-in-full-fix', 2017-09-25), this morphed into write_in_full(...) < 1 This behaves as we want, but we prefer to avoid modeling the "less than length" error-check which can be subtly buggy, as shown in efacf609c8 (config: avoid "write_in_full(fd, buf, len) < len" pattern, 2017-09-13). Signed-off-by: Jeff King <peff@peff.net> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Sep 25, 2017 at 16:27 UTC
88780c37b314d783db09118179ceba30096ef935
1 file changed
+1
-1
refs/files-backend.c
+1
-1
@@ -3007,7 +3007,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
3007
} else if (update &&
3008
(write_in_full(get_lock_file_fd(&lock->lk),
3009
oid_to_hex(&cb.last_kept_oid), GIT_SHA1_HEXSZ) < 0 ||
3010
- write_str_in_full(get_lock_file_fd(&lock->lk), "\n") < 1 ||
3010
+ write_str_in_full(get_lock_file_fd(&lock->lk), "\n") < 0 ||
3011
close_ref_gently(lock) < 0)) {
3012
status |= error("couldn't write %s",
3013
get_lock_file_path(&lock->lk));