From: Mike Ralphson Date: Thu, 26 Feb 2009 15:31:52 +0000 (+0100) Subject: Fix odb_mkstemp() on AIX X-Git-Tag: v1.6.2~10^2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2c626e5fa8a46f647b88fb32d7b28d573e8631bf;p=git.git 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 Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- diff --git a/wrapper.c b/wrapper.c index 231a58f1a..5e9de294d 100644 --- a/wrapper.c +++ b/wrapper.c @@ -208,9 +208,10 @@ int odb_mkstemp(char *template, size_t limit, const char *pattern) return fd; /* slow path */ - safe_create_leading_directories(template); + /* some mkstemp implementations erase template on failure */ snprintf(template, limit, "%s/%s", get_object_directory(), pattern); + safe_create_leading_directories(template); return xmkstemp(template); }