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 68739aa..a066e2e 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);