summaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2008-01-10 08:54:25 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-01-10 09:08:11 (GMT)
commit95693d45ee1c1d4b76cac672636cf31229186a18 (patch)
tree84b1bec8ad8a2ab4c24cc6552b918d295c7de9f5 /fast-import.c
parent35cda061640c26371d5841099ad30c6968d510b2 (diff)
downloadgit-95693d45ee1c1d4b76cac672636cf31229186a18.zip
git-95693d45ee1c1d4b76cac672636cf31229186a18.tar.gz
git-95693d45ee1c1d4b76cac672636cf31229186a18.tar.bz2
bundle, fast-import: detect write failure
I noticed some unchecked writes. This fixes them. * bundle.c (create_bundle): Die upon write failure. * fast-import.c (keep_pack): Die upon write or close failure. Signed-off-by: Jim Meyering <meyering@redhat.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fast-import.c b/fast-import.c
index 74597c9..82e9161 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -878,8 +878,9 @@ static char *keep_pack(char *curr_index_name)
keep_fd = open(name, O_RDWR|O_CREAT|O_EXCL, 0600);
if (keep_fd < 0)
die("cannot create keep file");
- write(keep_fd, keep_msg, strlen(keep_msg));
- close(keep_fd);
+ write_or_die(keep_fd, keep_msg, strlen(keep_msg));
+ if (close(keep_fd))
+ die("failed to write keep file");
snprintf(name, sizeof(name), "%s/pack/pack-%s.pack",
get_object_directory(), sha1_to_hex(pack_data->sha1));