]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
umount: fix umount by tag for non-roots
authorKarel Zak <kzak@redhat.com>
Tue, 19 Nov 2013 16:55:12 +0000 (17:55 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 19 Nov 2013 16:55:12 +0000 (17:55 +0100)
 $ umount LABEL=foo

currently does not work for non-root users as umount uses the
LABEL= as a path in sanitize_path().

Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/umount.c

index 47db5b4803ad09b3b93202d24b32d3cbd9d4f7bb..fe120dbaa16011783ad97bf3747054bdb283d3f9 100644 (file)
@@ -627,15 +627,17 @@ int main(int argc, char **argv)
                        rc += umount_recursive(cxt, *argv++);
        } else {
                while (argc--) {
-                       char *path = *argv++;
+                       char *path = *argv;
 
-                       if (mnt_context_is_restricted(cxt))
+                       if (mnt_context_is_restricted(cxt)
+                           && !mnt_tag_is_valid(path))
                                path = sanitize_path(path);
 
                        rc += umount_one(cxt, path);
 
-                       if (mnt_context_is_restricted(cxt))
+                       if (path != *argv)
                                free(path);
+                       argv++;
                }
        }