![Filippo Negroni](/assets/img/avatar_default.png)
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>
9 lines
153 B
C
9 lines
153 B
C
#include "../git-compat-util.h"
|
|
|
|
char *gitmkdtemp(char *template)
|
|
{
|
|
if (!*mktemp(template) || mkdir(template, 0700))
|
|
return NULL;
|
|
return template;
|
|
}
|