Clemens Buchacher <[email protected]> writes:
> diff --git a/sha1_file.c b/sha1_file.c
> index 77cd81d..62b7ad6 100644
> --- a/sha1_file.c
> +++ b/sha1_file.c
> @@ -1453,6 +1453,7 @@ int git_open_noatime(const char *name)
> static int sha1_file_open_flag = O_NOATIME;
>
> for (;;) {
> + errno = 0;
> int fd = open(name, O_RDONLY | sha1_file_open_flag);
Please avoid decl-after-stmt, which this codebase does not accept.
> if (fd >= 0)
> return fd;
More importantly, is this the right place to clear errno?
I would agree it is a good idea to clear it after seeing the first
open fail due to lack of O_NOATIME before trying open for the second
time, iow, more like this?
sha1_file.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sha1_file.c b/sha1_file.c
index 1cee438..bf2f229 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1467,6 +1467,7 @@ int git_open_noatime(const char *name)
/* Might the failure be due to O_NOATIME? */
if (errno != ENOENT && sha1_file_open_flag) {
+ errno = 0;
sha1_file_open_flag = 0;
continue;
}
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html