summaryrefslogtreecommitdiff
path: root/shallow.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-09-25 06:24:06 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-09-25 06:24:06 (GMT)
commitc50424a6f07f17ff9b06927606df650cd73a09a3 (patch)
tree8dad3903bf837ace4c3e05f223004864aead881d /shallow.c
parent94982b69994c448dafbc0721398f8944ab5856e3 (diff)
parentf48ecd38cb86b86f01914e875d74c92c077bf493 (diff)
downloadgit-c50424a6f07f17ff9b06927606df650cd73a09a3.zip
git-c50424a6f07f17ff9b06927606df650cd73a09a3.tar.gz
git-c50424a6f07f17ff9b06927606df650cd73a09a3.tar.bz2
Merge branch 'jk/write-in-full-fix'
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
Diffstat (limited to 'shallow.c')
-rw-r--r--shallow.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/shallow.c b/shallow.c
index 1cc1c76..eabb65d 100644
--- a/shallow.c
+++ b/shallow.c
@@ -294,7 +294,7 @@ const char *setup_temporary_shallow(const struct oid_array *extra)
if (write_shallow_commits(&sb, 0, extra)) {
temp = xmks_tempfile(git_path("shallow_XXXXXX"));
- if (write_in_full(temp->fd, sb.buf, sb.len) != sb.len ||
+ if (write_in_full(temp->fd, sb.buf, sb.len) < 0 ||
close_tempfile_gently(temp) < 0)
die_errno("failed to write to %s",
get_tempfile_path(temp));
@@ -319,7 +319,7 @@ void setup_alternate_shallow(struct lock_file *shallow_lock,
LOCK_DIE_ON_ERROR);
check_shallow_file_for_update();
if (write_shallow_commits(&sb, 0, extra)) {
- if (write_in_full(fd, sb.buf, sb.len) != sb.len)
+ if (write_in_full(fd, sb.buf, sb.len) < 0)
die_errno("failed to write to %s",
get_lock_file_path(shallow_lock));
*alternate_shallow_file = get_lock_file_path(shallow_lock);
@@ -366,7 +366,7 @@ void prune_shallow(int show_only)
LOCK_DIE_ON_ERROR);
check_shallow_file_for_update();
if (write_shallow_commits_1(&sb, 0, NULL, SEEN_ONLY)) {
- if (write_in_full(fd, sb.buf, sb.len) != sb.len)
+ if (write_in_full(fd, sb.buf, sb.len) < 0)
die_errno("failed to write to %s",
get_lock_file_path(&shallow_lock));
commit_lock_file(&shallow_lock);