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>
maint
Filippo Negroni 2010-02-25 10:01:31 +00:00 committed by Junio C Hamano
parent 0606c36a73
commit 1f80c2afb0
1 changed files with 1 additions and 1 deletions

View File

@ -2,7 +2,7 @@

char *gitmkdtemp(char *template)
{
if (!mktemp(template) || mkdir(template, 0700))
if (!*mktemp(template) || mkdir(template, 0700))
return NULL;
return template;
}