Skip to content

Commit 88780c3

Browse files
peffgitster
authored andcommitted
files-backend: prefer "0" for write_in_full() error check
Commit 06f46f2 (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 c50424a (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 efacf60 (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>
1 parent c50424a commit 88780c3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

refs/files-backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3007,7 +3007,7 @@ static int files_reflog_expire(struct ref_store *ref_store,
30073007
} else if (update &&
30083008
(write_in_full(get_lock_file_fd(&lock->lk),
30093009
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 ||
30113011
close_ref_gently(lock) < 0)) {
30123012
status |= error("couldn't write %s",
30133013
get_lock_file_path(&lock->lk));

0 commit comments

Comments
 (0)