summaryrefslogtreecommitdiff
path: root/compat/mkdtemp.c
diff options
context:
space:
mode:
authorLibravatar Filippo Negroni <fnegroni@flexerasoftware.com>2010-02-25 10:01:31 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-02-25 12:08:22 -0800
commit1f80c2afb0d826567a9a5a1c3ce76c28883e0e96 (patch)
tree9a5a5658f26fbeae32ed47b6c8a94fe3038c0805 /compat/mkdtemp.c
parentbase85: Make the code more obvious instead of explaining the non-obvious (diff)
downloadtgif-1f80c2afb0d826567a9a5a1c3ce76c28883e0e96.tar.xz
Fix gitmkdtemp: correct test for mktemp() return value
In gitmkdtemp, the return value of mktemp is not tested correctly. mktemp() always returns its 'template' argument, even upon failure. An error is signalled by making the template an empty string. Signed-off-by: Filippo Negroni <fnegroni@flexerasoftware.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat/mkdtemp.c')
-rw-r--r--compat/mkdtemp.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/compat/mkdtemp.c b/compat/mkdtemp.c
index 34d4b49818..1136119592 100644
--- a/compat/mkdtemp.c
+++ b/compat/mkdtemp.c
@@ -2,7 +2,7 @@
char *gitmkdtemp(char *template)
{
- if (!mktemp(template) || mkdir(template, 0700))
+ if (!*mktemp(template) || mkdir(template, 0700))
return NULL;
return template;
}