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 <patrick.higgins@cexp.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Higgins 2008-06-23 15:33:41 -06:00 committed by Junio C Hamano
parent 010a2dacc1
commit 6ff6af62ec

View File

@ -2118,6 +2118,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename)
fd = mkstemp(buffer); fd = mkstemp(buffer);
if (fd < 0 && dirlen) { if (fd < 0 && dirlen) {
/* Make sure the directory exists */ /* Make sure the directory exists */
memcpy(buffer, filename, dirlen);
buffer[dirlen-1] = 0; buffer[dirlen-1] = 0;
if (mkdir(buffer, 0777) || adjust_shared_perm(buffer)) if (mkdir(buffer, 0777) || adjust_shared_perm(buffer))
return -1; return -1;