@matheusbsbs / matheus-bagliano / commits / 6ff6af62ec
Fork 0

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>

Patrick Higgins committed Jun 23, 2008 at 15:33 UTC 6ff6af62ec70e04676b35260a7f4b9fafc8f0973
1 file changed +1
sha1_file.c
+1
@@ -2118,6 +2118,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename)
2118 fd = mkstemp(buffer);
2119 if (fd < 0 && dirlen) {
2120 /* Make sure the directory exists */
2121 + memcpy(buffer, filename, dirlen);
2122 buffer[dirlen-1] = 0;
2123 if (mkdir(buffer, 0777) || adjust_shared_perm(buffer))
2124 return -1;