Merge branch 'jc/mkstemp-more-careful-error-reporting'
authorJunio C Hamano <gitster@pobox.com>
Wed, 2 Jan 2013 18:38:25 +0000 (10:38 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 Jan 2013 18:38:25 +0000 (10:38 -0800)
After failing to create a temporary file using mkstemp(), failing
pathname was not reported correctly on some platforms.

* jc/mkstemp-more-careful-error-reporting:
xmkstemp(): avoid showing truncated template more carefully

wrapper.c
index 68739aaa3b9e9e1a1bbbd43c75c9b5c244fb6c3e..a066e2ee9e2cc90ad77547ee9f2267e255cf7d23 100644 (file)
--- 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);