summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 0606c36)
raw | patch | inline | side by side (parent: 0606c36)
author | Filippo Negroni <fnegroni@flexerasoftware.com> | |
Thu, 25 Feb 2010 10:01:31 +0000 (10:01 +0000) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 25 Feb 2010 20:08:22 +0000 (12:08 -0800) |
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>
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>
compat/mkdtemp.c | patch | blob | history |
diff --git a/compat/mkdtemp.c b/compat/mkdtemp.c
index 34d4b49818b0896b9db19b2b1387f142cbbbd42b..11361195925c674423309d40f343c88f58b7bc1e 100644 (file)
--- a/compat/mkdtemp.c
+++ b/compat/mkdtemp.c
char *gitmkdtemp(char *template)
{
- if (!mktemp(template) || mkdir(template, 0700))
+ if (!*mktemp(template) || mkdir(template, 0700))
return NULL;
return template;
}