@matheusbsbs / matheus-bagliano / commits / 2c626e5fa8
Fork 0

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 6ff6af62, which fixed this problem in a different spot. Signed-off-by: Mike Ralphson <mike@abacus.co.uk> Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Mike Ralphson committed Feb 26, 2009 at 16:31 UTC 2c626e5fa8a46f647b88fb32d7b28d573e8631bf
1 file changed +2 -1
wrapper.c
+2 -1
@@ -208,9 +208,10 @@ int odb_mkstemp(char *template, size_t limit, const char *pattern)
208 return fd;
209
210 /* slow path */
211 - safe_create_leading_directories(template);
211 + /* some mkstemp implementations erase template on failure */
212 snprintf(template, limit, "%s/%s",
213 get_object_directory(), pattern);
214 + safe_create_leading_directories(template);
215 return xmkstemp(template);
216 }
217