git_open_noatime: return with errno=0 on success
[gitweb.git] / sha1_file.c
index d7f1838c13f5a88448d0f2034347bfb6482b3edf..3502dcf66641005ff5377d211c3f5198caf494b9 100644 (file)
@@ -1446,7 +1446,10 @@ int git_open_noatime(const char *name)
        static int sha1_file_open_flag = O_NOATIME;
 
        for (;;) {
-               int fd = open(name, O_RDONLY | sha1_file_open_flag);
+               int fd;
+
+               errno = 0;
+               fd = open(name, O_RDONLY | sha1_file_open_flag);
                if (fd >= 0)
                        return fd;