Add macro for checking if some flags are set
This way we don't need to repeat the argument twice. I didn't replace all instances. I think it's better to leave out: - asserts - comparisons like x & y == x, which are mathematically equivalent, but here we aren't checking if flags are set, but if the argument fits in the flags.
This commit is contained in:
+2
-2
@@ -602,10 +602,10 @@ int chase_symlinks(const char *path, const char *original_root, unsigned flags,
|
||||
assert(path);
|
||||
|
||||
/* Either the file may be missing, or we return an fd to the final object, but both make no sense */
|
||||
if ((flags & (CHASE_NONEXISTENT|CHASE_OPEN)) == (CHASE_NONEXISTENT|CHASE_OPEN))
|
||||
if (FLAGS_SET(flags, CHASE_NONEXISTENT | CHASE_OPEN))
|
||||
return -EINVAL;
|
||||
|
||||
if ((flags & (CHASE_STEP|CHASE_OPEN)) == (CHASE_STEP|CHASE_OPEN))
|
||||
if (FLAGS_SET(flags, CHASE_STEP | CHASE_OPEN))
|
||||
return -EINVAL;
|
||||
|
||||
if (isempty(path))
|
||||
|
||||
Reference in New Issue
Block a user