aboutsummaryrefslogtreecommitdiff
path: root/fast-import.c
diff options
context:
space:
mode:
authorLuiz Fernando N. Capitulino <lcapitulino@mandriva.com.br>2007-08-14 16:45:58 -0300
committerJunio C Hamano <gitster@pobox.com>2007-08-14 22:20:26 -0700
commit7647b17f1d7a98362f8bdbe48b30d94ed655229c (patch)
treecf0ec675b95439b5abec90cdc1e9853d61b4dfb4 /fast-import.c
parentf21a47b27ceef8ff2f6f218d5b7266d5fd9e2e93 (diff)
downloadgit-7647b17f1d7a98362f8bdbe48b30d94ed655229c.tar.gz
git-7647b17f1d7a98362f8bdbe48b30d94ed655229c.tar.xz
Use xmkstemp() instead of mkstemp()
xmkstemp() performs error checking and prints a standard error message when an error occur. Signed-off-by: Luiz Fernando N. Capitulino <lcapitulino@mandriva.com.br> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fast-import.c')
-rw-r--r--fast-import.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/fast-import.c b/fast-import.c
index 99a19d89e..170cccdce 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -663,9 +663,7 @@ static void start_packfile(void)
snprintf(tmpfile, sizeof(tmpfile),
"%s/tmp_pack_XXXXXX", get_object_directory());
- pack_fd = mkstemp(tmpfile);
- if (pack_fd < 0)
- die("Can't create %s: %s", tmpfile, strerror(errno));
+ pack_fd = xmkstemp(tmpfile);
p = xcalloc(1, sizeof(*p) + strlen(tmpfile) + 2);
strcpy(p->pack_name, tmpfile);
p->pack_fd = pack_fd;
@@ -727,9 +725,7 @@ static char *create_index(void)
snprintf(tmpfile, sizeof(tmpfile),
"%s/tmp_idx_XXXXXX", get_object_directory());
- idx_fd = mkstemp(tmpfile);
- if (idx_fd < 0)
- die("Can't create %s: %s", tmpfile, strerror(errno));
+ idx_fd = xmkstemp(tmpfile);
f = sha1fd(idx_fd, tmpfile);
sha1write(f, array, 256 * sizeof(int));
SHA1_Init(&ctx);