1 #define COMPAT_CODE_ACCESS
2 #include "../git-compat-util.h"
4 /* Do the same thing access(2) does, but use the effective uid,
5 * and don't make the mistake of telling root that any file is
6 * executable. This version uses stat(2).
8 int git_access(const char *path
, int mode
)
12 /* do not interfere a normal user */
14 return access(path
, mode
);
16 if (stat(path
, &st
) < 0)
19 /* Root can read or write any file. */
23 /* Root can execute any file that has any one of the execute
26 if (st
.st_mode
& (S_IXUSR
| S_IXGRP
| S_IXOTH
))