From: Patrick Higgins Date: Mon, 23 Jun 2008 21:33:41 +0000 (-0600) Subject: Workaround for AIX mkstemp() X-Git-Tag: v1.5.6.1~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6ff6af62ec70e04676b35260a7f4b9fafc8f0973;p=git.git 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 --- 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;