summaryrefslogtreecommitdiff
path: root/wrapper.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-12-18 20:51:35 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-12-18 21:02:33 (GMT)
commitf7be59b4770a8a8b76c1d0612db409ce7e8d11f2 (patch)
tree4a1fa0d583f326824e47e71c7068a7b67e1553e4 /wrapper.c
parent7e2010537e96d0a1144520222f20ba1dc3d61441 (diff)
downloadgit-f7be59b4770a8a8b76c1d0612db409ce7e8d11f2.zip
git-f7be59b4770a8a8b76c1d0612db409ce7e8d11f2.tar.gz
git-f7be59b4770a8a8b76c1d0612db409ce7e8d11f2.tar.bz2
xmkstemp(): avoid showing truncated template more carefully
Some implementations of xmkstemp() leaves the given in/out buffer truncated when they return with failure. 6cf6bb3 (Improve error messages when temporary file creation fails, 2010-12-18) attempted to show the real filename we tried to create (but failed), and if that is not available due to such truncation, to show the original template that was given by the caller. But it failed to take into account that the given template could have "directory/" in front, in which case the truncation point may not be template[0] but somewhere else. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'wrapper.c')
-rw-r--r--wrapper.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/wrapper.c b/wrapper.c
index 68739aa..a066e2e 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -229,7 +229,7 @@ int xmkstemp(char *template)
int saved_errno = errno;
const char *nonrelative_template;
- if (!template[0])
+ if (strlen(template) != strlen(origtemplate))
template = origtemplate;
nonrelative_template = absolute_path(template);