aboutsummaryrefslogtreecommitdiff
path: root/builtin-pack-objects.c
diff options
context:
space:
mode:
authorAlex Riesen <raa.lkml@gmail.com>2007-05-07 19:33:24 +0200
committerJunio C Hamano <junkio@cox.net>2007-05-07 15:45:24 -0700
commit3082acfa7c626a34aa419a163585051c2df2bf09 (patch)
tree01789a542d023a56482c4ef646dc5733ebf3ce10 /builtin-pack-objects.c
parent0fc4baebf318d211ad35af447cde7cd814aa57e9 (diff)
downloadgit-3082acfa7c626a34aa419a163585051c2df2bf09.tar.gz
git-3082acfa7c626a34aa419a163585051c2df2bf09.tar.xz
Use GIT_OBJECT_DIR for temporary files of pack-objects
Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'builtin-pack-objects.c')
-rw-r--r--builtin-pack-objects.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index b82762767..7bff8eadd 100644
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
@@ -559,6 +559,12 @@ static off_t write_one(struct sha1file *f,
return offset + size;
}
+static int open_object_dir_tmp(const char *path)
+{
+ snprintf(tmpname, sizeof(tmpname), "%s/%s", get_object_directory(), path);
+ return mkstemp(tmpname);
+}
+
static off_t write_pack_file(void)
{
uint32_t i;
@@ -571,9 +577,7 @@ static off_t write_pack_file(void)
f = sha1fd(1, "<stdout>");
do_progress >>= 1;
} else {
- int fd;
- snprintf(tmpname, sizeof(tmpname), "tmp_pack_XXXXXX");
- fd = mkstemp(tmpname);
+ int fd = open_object_dir_tmp("tmp_pack_XXXXXX");
if (fd < 0)
die("unable to create %s: %s\n", tmpname, strerror(errno));
pack_tmp_name = xstrdup(tmpname);
@@ -623,10 +627,8 @@ static void write_index_file(off_t last_obj_offset, unsigned char *sha1)
uint32_t array[256];
uint32_t i, index_version;
SHA_CTX ctx;
- int fd;
- snprintf(tmpname, sizeof(tmpname), "tmp_idx_XXXXXX");
- fd = mkstemp(tmpname);
+ int fd = open_object_dir_tmp("tmp_idx_XXXXXX");
if (fd < 0)
die("unable to create %s: %s\n", tmpname, strerror(errno));
idx_tmp_name = xstrdup(tmpname);