Skip to content

Commit

Permalink
Fix odb_mkstemp() on AIX
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
MikeRalphson authored and gitster committed Feb 26, 2009
1 parent 6e180cd commit 2c626e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 2c626e5

Please sign in to comment.