git_mkstemps_mode: don't set errno to EINVAL on exit.
authorMatthieu Moy <Matthieu.Moy@imag.fr>
Mon, 22 Feb 2010 22:32:15 +0000 (23:32 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Feb 2010 23:24:46 +0000 (15:24 -0800)
When reaching the end of git_mkstemps_mode, at least one call to open()
has been done, and errno has been set accordingly. Setting errno is
therefore not necessary, and actually harmfull since callers can't
distinguish e.g. permanent failure from ENOENT, which can just mean that
we need to create the containing directory.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
path.c

diff --git a/path.c b/path.c
index 03d284ba8bc76d873d289efbf45404cad58f111a..12ef731acebb96481dcc2360648ce4e1b85de33d 100644 (file)
--- a/path.c
+++ b/path.c
@@ -222,7 +222,6 @@ int git_mkstemps_mode(char *pattern, int suffix_len, int mode)
        }
        /* We return the null string if we can't find a unique file name.  */
        pattern[0] = '\0';
-       errno = EINVAL;
        return -1;
 }