Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
safe_create_leading_directories_const(): preserve errno
author
Michael Haggerty
<mhagger@alum.mit.edu>
Fri, 6 Jan 2017 16:22:24 +0000
(17:22 +0100)
committer
Junio C Hamano
<gitster@pobox.com>
Sun, 8 Jan 2017 03:30:08 +0000
(19:30 -0800)
Some implementations of free() change errno (even thought they
shouldn't):
https://sourceware.org/bugzilla/show_bug.cgi?id=17924
So preserve the errno from safe_create_leading_directories() across the
call to free().
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c
patch
|
blob
|
history
raw
|
patch
| inline |
side by side
(parent:
2eb7a0e
)
diff --git
a/sha1_file.c
b/sha1_file.c
index 1173071859dae68f72cc72efb20f816152d3eabc..10395e7e4bb53e107bfb26bdc84768d0883d362f 100644
(file)
--- a/
sha1_file.c
+++ b/
sha1_file.c
@@
-166,10
+166,14
@@
enum scld_error safe_create_leading_directories(char *path)
enum scld_error safe_create_leading_directories_const(const char *path)
{
+ int save_errno;
/* path points to cache entries, so xstrdup before messing with it */
char *buf = xstrdup(path);
enum scld_error result = safe_create_leading_directories(buf);
+
+ save_errno = errno;
free(buf);
+ errno = save_errno;
return result;
}