Skip to content

Commit 6ff6af6

Browse files
Patrick Higginsgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 010a2da commit 6ff6af6

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sha1_file.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,6 +2118,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename)
21182118
fd = mkstemp(buffer);
21192119
if (fd < 0 && dirlen) {
21202120
/* Make sure the directory exists */
2121+
memcpy(buffer, filename, dirlen);
21212122
buffer[dirlen-1] = 0;
21222123
if (mkdir(buffer, 0777) || adjust_shared_perm(buffer))
21232124
return -1;

0 commit comments

Comments
 (0)