]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: fix MS_BIND|MS_REC usage, improve some bitwise operations
authorKarel Zak <kzak@redhat.com>
Mon, 16 Jan 2012 11:29:27 +0000 (12:29 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Jan 2012 11:29:27 +0000 (12:29 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libmount/src/context_umount.c
libmount/src/optstr.c

index 9d7701f6edfed38b0189d146b0d4cb1fd0d35964..939f66e7f5fce0de825c741118318537e050566d 100644 (file)
@@ -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
                 */
index 260dc26a8127819e87754c1548746d711b6fee34..9e98798af494f545c593980b3af0ceb836954b42 100644 (file)
@@ -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) */