Skip to content

Commit 2c626e5

Browse files
MikeRalphsongitster
authored andcommitted
Fix odb_mkstemp() on AIX
The AIX mkstemp() modifies its template parameter to an empty string if the call fails. The existing code had already recomputed the template, but too late to be good. See also 6ff6af6, which fixed this problem in a different spot. Signed-off-by: Mike Ralphson <[email protected]> Signed-off-by: Johannes Sixt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 6e180cd commit 2c626e5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

wrapper.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,10 @@ int odb_mkstemp(char *template, size_t limit, const char *pattern)
208208
return fd;
209209

210210
/* slow path */
211-
safe_create_leading_directories(template);
211+
/* some mkstemp implementations erase template on failure */
212212
snprintf(template, limit, "%s/%s",
213213
get_object_directory(), pattern);
214+
safe_create_leading_directories(template);
214215
return xmkstemp(template);
215216
}
216217

0 commit comments

Comments
 (0)