]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
umount: be more strict about --all
authorKarel Zak <kzak@redhat.com>
Thu, 6 Jun 2019 12:52:40 +0000 (14:52 +0200)
committerKarel Zak <kzak@redhat.com>
Thu, 6 Jun 2019 12:56:48 +0000 (14:56 +0200)
If you by accident execute

umount ls -al /mnt/

then umount --all is executed and another arguments silently ignored.
It seems better to be more strict in this case.

Reported-by: Harald Dunkel <harald.dunkel@aixigo.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/umount.c

index e3734b0ec20cd7b16adaf5c36bcc81a500e122d4..397e0ebfc5df554b9471969a7fab967d2b29548c 100644 (file)
@@ -573,6 +573,10 @@ int main(int argc, char **argv)
        argv += optind;
 
        if (all) {
+               if (argc) {
+                       warnx(_("unexpected number of arguments"));
+                       errtryhelp(MNT_EX_USAGE);
+               }
                if (!types)
                        types = "noproc,nodevfs,nodevpts,nosysfs,norpc_pipefs,nonfsd,noselinuxfs";