1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-23 12:36:09 +02:00
git/compat/mkdtemp.c
Filippo Negroni 1f80c2afb0 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>
2010-02-25 12:08:22 -08:00

9 lines
153 B
C

#include "../git-compat-util.h"
char *gitmkdtemp(char *template)
{
if (!*mktemp(template) || mkdir(template, 0700))
return NULL;
return template;
}