diff options
author | Karel Zak | 2012-01-16 12:29:27 +0100 |
---|---|---|
committer | Karel Zak | 2012-01-16 12:29:27 +0100 |
commit | 07a67e6805aa92d98371ea6badaa2f879125358d (patch) | |
tree | 5775c90817d793fe1d749e5bb3e1a9d21ee5a782 | |
parent | libmount: add post-mount checks to detect ro/rw (diff) | |
download | kernel-qcow2-util-linux-07a67e6805aa92d98371ea6badaa2f879125358d.tar.gz kernel-qcow2-util-linux-07a67e6805aa92d98371ea6badaa2f879125358d.tar.xz kernel-qcow2-util-linux-07a67e6805aa92d98371ea6badaa2f879125358d.zip |
libmount: fix MS_BIND|MS_REC usage, improve some bitwise operations
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | libmount/src/context_umount.c | 6 | ||||
-rw-r--r-- | libmount/src/optstr.c | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/libmount/src/context_umount.c b/libmount/src/context_umount.c index 9d7701f6e..939f66e7f 100644 --- a/libmount/src/context_umount.c +++ b/libmount/src/context_umount.c @@ -307,8 +307,7 @@ static int evaluate_permissions(struct libmnt_context *cxt) * Check user=<username> setting from mtab if there is user, owner or * group option in /etc/fstab */ - if ((u_flags & MNT_MS_USER) || (u_flags & MNT_MS_OWNER) || - (u_flags & MNT_MS_GROUP)) { + if (u_flags & (MNT_MS_USER | MNT_MS_OWNER | MNT_MS_GROUP)) { char *curr_user = NULL; char *mtab_user = NULL; @@ -670,7 +669,8 @@ int mnt_context_do_umount(struct libmnt_context *cxt) return rc; if ((cxt->flags & MNT_FL_RDONLY_UMOUNT) && - (cxt->mountflags & (MS_RDONLY | MS_REMOUNT))) { + (cxt->mountflags & (MS_RDONLY | MS_REMOUNT)) + == (MS_RDONLY | MS_REMOUNT)) { /* * fix options, remount --> read-only mount */ diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c index 260dc26a8..9e98798af 100644 --- a/libmount/src/optstr.c +++ b/libmount/src/optstr.c @@ -700,7 +700,7 @@ int mnt_optstr_apply_flags(char **optstr, unsigned long flags, continue; if (ent->id == MS_RDONLY || (ent->mask & MNT_INVERT) || - !(fl & ent->id)) { + (fl & ent->id) != ent->id) { char *end = val ? val + valsz : name + namesz; @@ -722,7 +722,7 @@ int mnt_optstr_apply_flags(char **optstr, unsigned long flags, char *p; for (ent = map; ent && ent->name; ent++) { - if ((ent->mask & MNT_INVERT) || !(fl & ent->id)) + if ((ent->mask & MNT_INVERT) || (fl & ent->id) != ent->id) continue; /* don't add options which require values (e.g. offset=%d) */ |