diff options
author | Karel Zak | 2013-11-19 17:55:12 +0100 |
---|---|---|
committer | Karel Zak | 2013-11-19 17:55:12 +0100 |
commit | d41acf740ecbe0493139582d6833db4f2938cf5d (patch) | |
tree | 1ccd833f009ada3ac4c1c46a282c6822fc84bd42 /sys-utils/umount.c | |
parent | libblkid: fix memory leak in blkid_parse_tag_string() (diff) | |
download | kernel-qcow2-util-linux-d41acf740ecbe0493139582d6833db4f2938cf5d.tar.gz kernel-qcow2-util-linux-d41acf740ecbe0493139582d6833db4f2938cf5d.tar.xz kernel-qcow2-util-linux-d41acf740ecbe0493139582d6833db4f2938cf5d.zip |
umount: fix umount by tag for non-roots
$ 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>
Diffstat (limited to 'sys-utils/umount.c')
-rw-r--r-- | sys-utils/umount.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys-utils/umount.c b/sys-utils/umount.c index 47db5b480..fe120dbaa 100644 --- a/sys-utils/umount.c +++ b/sys-utils/umount.c @@ -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++; } } |