fs-util: introduce at_flags_normalize_nofollow() helper
This commit is contained in:
@@ -163,3 +163,12 @@ static inline int xopenat_lock(int dir_fd, const char *path, int open_flags, Loc
|
||||
int link_fd(int fd, int newdirfd, const char *newpath);
|
||||
|
||||
int linkat_replace(int olddirfd, const char *oldpath, int newdirfd, const char *newpath);
|
||||
|
||||
static inline int at_flags_normalize_nofollow(int flags) {
|
||||
if (FLAGS_SET(flags, AT_SYMLINK_FOLLOW)) {
|
||||
assert(!FLAGS_SET(flags, AT_SYMLINK_NOFOLLOW));
|
||||
flags &= ~AT_SYMLINK_FOLLOW;
|
||||
} else
|
||||
flags |= AT_SYMLINK_NOFOLLOW;
|
||||
return flags;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user