diff options
-rw-r--r-- | sha1_file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sha1_file.c b/sha1_file.c index 12fc767ee..1d7f3b6ce 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2220,7 +2220,7 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename) memcpy(buffer, filename, dirlen); strcpy(buffer + dirlen, "tmp_obj_XXXXXX"); fd = mkstemp(buffer); - if (fd < 0 && dirlen) { + if (fd < 0 && dirlen && errno == ENOENT) { /* Make sure the directory exists */ memcpy(buffer, filename, dirlen); buffer[dirlen-1] = 0; |