From 6ff6af62ec70e04676b35260a7f4b9fafc8f0973 Mon Sep 17 00:00:00 2001 From: Patrick Higgins Date: Mon, 23 Jun 2008 15:33:41 -0600 Subject: [PATCH] Workaround for AIX mkstemp() The AIX mkstemp will modify it's template parameter to an empty string if the call fails. This caused a subsequent mkdir to fail. Signed-off-by: Patrick Higgins Signed-off-by: Junio C Hamano --- sha1_file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sha1_file.c b/sha1_file.c index 191f814e0..92299ed62 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2118,6 +2118,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename) fd = mkstemp(buffer); if (fd < 0 && dirlen) { /* Make sure the directory exists */ + memcpy(buffer, filename, dirlen); buffer[dirlen-1] = 0; if (mkdir(buffer, 0777) || adjust_shared_perm(buffer)) return -1; -- 2.11.0