Fix gitmkdtemp: correct test for mktemp() return value
PATCH 1/1 Fix gitmkdtemp: correct test for mktemp() return value
Quoted 1 line
From
5e3b362cdd86150de901312c01beac9596b7e2baMon Sep 17 00:00:00 2001
From: Filippo Negroni <[email protected]>
Date: Thu, 25 Feb 2010 09:39:56 +0000
Subject: [PATCH] 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 failre.
Upon failure, mktemp sets template to be an empty string: its first character is '\0'.
This patch ensures the return value of mktemp is correctly tested by dereferencing the pointer returned by it.
--- compat/mkdtemp.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
compat/mkdtemp.c +1 -1
@@ -2,7 +2,7 @@char *gitmkdtemp (char *template) { -if (!mktemp (template) ||mkdir (template,0700 )) +if (!*mktemp (template) ||mkdir (template,0700 ))return NULL ;return template; }
Signature · 1 line
1.6.4
Quoted 5 lines · Filippo Negroni
From
5e3b362cdd86150de901312c01beac9596b7e2baMon Sep 17 00:00:00 2001
From: Filippo Negroni <[email protected]>
Date: Thu, 25 Feb 2010 09:39:56 +0000
Subject: [PATCH] Fix gitmkdtemp: correct test formktemp()return value
Quoted 7 lines
In gitmkdtemp, the return value of mktemp is not tested correctly.
mktemp()always returns its 'template' argument, even upon failre.
Upon failure, mktemp sets template to be an empty string: its first character is '\0'.
This patch ensures the return value of mktemp is correctly tested by dereferencing the pointer returned by it.Signed-off-by Filippo Negroni <[email protected]>---
Thanks.
Next time please do not quote the mbox header lines (i.e. start your body with "In gitmkdtemp, the return value ...".
Quoted 2 lines · Junio C Hamano
Next time please do not quote the mbox header lines (i.e. start your body with "In gitmkdtemp, the return value ...".
... or just use "git send-email", which does the trick for you.
Signature · 2 lines
Matthieu Moy http://www-verimag.imag.fr/~moy/