From: AtariDreams <83477269+AtariDreams@users.noreply.github.com> Date: Tue, 9 Jan 2024 01:18:10 +0000 (-0500) Subject: simplify bitwise checking (#30722) X-Git-Tag: v256-rc1~1231 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5ba46b99f7fa4a8489920007e430aaec5480bd03;p=thirdparty%2Fsystemd.git simplify bitwise checking (#30722) Some of these checks before bitwise operations are redundant and compilers do not always recognize them, so let's simplify the code to make the intentions clearer. --- diff --git a/src/core/namespace.c b/src/core/namespace.c index df6d0b4485c..1bfd6b6ca0e 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -626,8 +626,7 @@ static int append_tmpfs_mounts(MountList *ml, const TemporaryFileSystem *tmpfs, return log_debug_errno(r, "Failed to parse mount option '%s': %m", str); ro = flags & MS_RDONLY; - if (ro) - flags ^= MS_RDONLY; + flags &= ~MS_RDONLY; MountEntry *me = mount_list_extend(ml); if (!me) diff --git a/src/shared/mount-util.c b/src/shared/mount-util.c index ba3a9e995d1..3305b6360e7 100644 --- a/src/shared/mount-util.c +++ b/src/shared/mount-util.c @@ -821,8 +821,8 @@ int mount_option_mangle( if (!(ent->mask & MNT_INVERT)) mount_flags |= ent->id; - else if (mount_flags & ent->id) - mount_flags ^= ent->id; + else + mount_flags &= ~ent->id; break; }