Codebase list pseudo / b9d58f6
New upstream version 1.9.0+git20190802+060058b Andrej Shadura 4 years ago
3 changed file(s) with 33 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
0 2019-08-02:
1 * (seebs) Pass flags & O_NOFOLLOW, also use that to influence
2 stat types. Note. &. Not |.
3
4 2019-08-01:
5 * (seebs) Pass flags|O_NOFOLLOW on when resolving paths with openat.
6
07 2019-05-15:
18 * (RP) Add SDPX license headers to source files.
29
5454 if (flags & O_CREAT) {
5555 save_errno = errno;
5656 #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
57 rc = real___xstat64(_STAT_VER, path, &buf);
57 if (flags & O_NOFOLLOW) {
58 rc = real___lxstat64(_STAT_VER, path, &buf);
59 } else {
60 rc = real___xstat64(_STAT_VER, path, &buf);
61 }
5862 #else
59 rc = real___fxstatat64(_STAT_VER, dirfd, path, &buf, 0);
63 rc = real___fxstatat64(_STAT_VER, dirfd, path, &buf, (flags & O_NOFOLLOW) ? AT_SYMLINK_NOFOLLOW : 0);
6064 #endif
6165 existed = (rc != -1);
6266 if (!existed)
7175 if (!(flags & O_NONBLOCK) && ((flags & (O_WRONLY | O_RDONLY | O_RDWR)) != O_RDWR)) {
7276 save_errno = errno;
7377 #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
74 rc = real___xstat64(_STAT_VER, path, &buf);
78 if (flags & O_NOFOLLOW) {
79 rc = real___lxstat64(_STAT_VER, path, &buf);
80 } else {
81 rc = real___xstat64(_STAT_VER, path, &buf);
82 }
7583 #else
76 rc = real___fxstatat64(_STAT_VER, dirfd, path, &buf, 0);
84 rc = real___fxstatat64(_STAT_VER, dirfd, path, &buf, (flags & O_NOFOLLOW) ? AT_SYMLINK_NOFOLLOW : 0);
7785 #endif
7886 if (rc != -1 && S_ISFIFO(buf.st_mode)) {
7987 overly_magic_nonblocking = 1;
125133 }
126134 #endif
127135 #ifdef PSEUDO_NO_REAL_AT_FUNCTIONS
128 stat_rc = real___xstat64(_STAT_VER, path, &buf);
136 if (flags & O_NOFOLLOW) {
137 stat_rc = real___lxstat64(_STAT_VER, path, &buf);
138 } else {
139 stat_rc = real___xstat64(_STAT_VER, path, &buf);
140 }
129141 #else
130 stat_rc = real___fxstatat64(_STAT_VER, dirfd, path, &buf, 0);
142 stat_rc = real___fxstatat64(_STAT_VER, dirfd, path, &buf, (flags & O_NOFOLLOW) ? AT_SYMLINK_NOFOLLOW : 0);
131143 #endif
132144
145 pseudo_debug(PDBGF_FILE, "openat(path %s), flags %o, stat rc %d, stat mode %o\n",
146 path, flags, stat_rc, buf.st_mode);
133147 if (stat_rc != -1) {
134148 buf.st_mode = PSEUDO_DB_MODE(buf.st_mode, mode);
135149 if (!existed) {
0 int open(const char *path, int flags, ...{mode_t mode}); /* flags=0 */
0 int open(const char *path, int flags, ...{mode_t mode}); /* flags=flags&O_NOFOLLOW */
11 char *get_current_dir_name(void);
22 int __xstat(int ver, const char *path, struct stat *buf);
33 int __lxstat(int ver, const char *path, struct stat *buf); /* flags=AT_SYMLINK_NOFOLLOW */
44 int __fxstat(int ver, int fd, struct stat *buf);
55 int lchown(const char *path, uid_t owner, gid_t group); /* flags=AT_SYMLINK_NOFOLLOW */
66 int __fxstatat(int ver, int dirfd, const char *path, struct stat *buf, int flags);
7 int openat(int dirfd, const char *path, int flags, ...{mode_t mode}); /* flags=0 */
8 int __openat_2(int dirfd, const char *path, int flags); /* flags=0 */
7 int openat(int dirfd, const char *path, int flags, ...{mode_t mode}); /* flags=flags&O_NOFOLLOW */
8 int __openat_2(int dirfd, const char *path, int flags); /* flags=flags&O_NOFOLLOW */
99 int mknod(const char *path, mode_t mode, dev_t dev); /* real_func=pseudo_mknod */
1010 int mknodat(int dirfd, const char *path, mode_t mode, dev_t dev); /* real_func=pseudo_mknodat */
1111 int __xmknod(int ver, const char *path, mode_t mode, dev_t *dev); /* flags=AT_SYMLINK_NOFOLLOW */
1414 # just so we know the inums of symlinks
1515 char *canonicalize_file_name(const char *filename);
1616 int eaccess(const char *path, int mode);
17 int open64(const char *path, int flags, ...{mode_t mode}); /* flags=0 */
18 int openat64(int dirfd, const char *path, int flags, ...{mode_t mode}); /* flags=0 */
19 int __openat64_2(int dirfd, const char *path, int flags); /* flags=0 */
17 int open64(const char *path, int flags, ...{mode_t mode}); /* flags=flags&O_NOFOLLOW */
18 int openat64(int dirfd, const char *path, int flags, ...{mode_t mode}); /* flags=flags&O_NOFOLLOW */
19 int __openat64_2(int dirfd, const char *path, int flags); /* flags=flags&O_NOFOLLOW */
2020 int creat64(const char *path, mode_t mode);
2121 int stat(const char *path, struct stat *buf); /* real_func=pseudo_stat */
2222 int lstat(const char *path, struct stat *buf); /* real_func=pseudo_lstat, flags=AT_SYMLINK_NOFOLLOW */