X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fmount%2Fnfsumount.c;h=81d0d3a72c4ea5ca1a1230e3991b33fc38f38164;hb=b8b6a251c372b134e66d0f436bf2c6231cc1c055;hp=1decf07d7debd2bc2fdf857c9275082b90b73f0c;hpb=cb2342b123ded9f074345e15e5ffc0dbfeb095e0;p=nfs-utils.git diff --git a/utils/mount/nfsumount.c b/utils/mount/nfsumount.c index 1decf07..81d0d3a 100644 --- a/utils/mount/nfsumount.c +++ b/utils/mount/nfsumount.c @@ -288,6 +288,7 @@ int nfsumount(int argc, char *argv[]) argv += 1; argc -= 1; + argv[0] = argv[-1]; /* So that getopt error messages are correct */ while ((c = getopt_long (argc, argv, "fvnrlh", umount_longopts, NULL)) != -1) { @@ -313,6 +314,10 @@ int nfsumount(int argc, char *argv[]) return 0; } } + if (optind != argc) { + umount_usage(); + return 0; + } if (spec == NULL || (*spec != '/' && strchr(spec,':') == NULL)) { printf(_("umount: %s: not found\n"), spec); @@ -326,6 +331,13 @@ int nfsumount(int argc, char *argv[]) if (!mc && verbose) printf(_("Could not find %s in mtab\n"), spec); + if (mc && strcmp(mc->m.mnt_type, "nfs") != 0 && + strcmp(mc->m.mnt_type, "nfs4") != 0) { + fprintf(stderr, "umount.nfs: %s on %s it not an nfs filesystem\n", + mc->m.mnt_fsname, mc->m.mnt_dir); + exit(1); + } + if (getuid() != 0) { /* only permitted if "user=" or "users" is in mount options */ if (!mc) {