X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Fnfsumount.c;h=e65f58f0122374ad92f881d96e7072a9f0fbe03e;hp=e101105268d3bdd9bd42a49ca3649b3b17250383;hb=b3b111b1bd5fbc678419bf1964b6093045081139;hpb=4bc447f758ee4d64706b990ac68cb766dbff113c diff --git a/utils/mount/nfsumount.c b/utils/mount/nfsumount.c index e101105..e65f58f 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) { @@ -340,6 +341,11 @@ int nfsumount(int argc, char *argv[]) if (getuid() != 0) { /* only permitted if "user=" or "users" is in mount options */ if (!mc) { + /* umount might call us twice. The second time there will + * be no entry in mtab and we should just exit quietly + */ + return 0; + only_root: fprintf(stderr,"%s: You are not permitted to unmount %s\n", progname, spec); @@ -352,7 +358,7 @@ int nfsumount(int argc, char *argv[]) int len; if (!opt) goto only_root; - if (opt[5] != '=') + if (opt[4] != '=') goto only_root; comma = strchr(opt, ','); if (comma)