X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=utils%2Fmount%2Fnfsumount.c;h=b9737be23d355b86fd40a66d64adc22542755215;hb=3b55934b9baefecee17aefc3ea139e261a4b03b8;hp=81d0d3a72c4ea5ca1a1230e3991b33fc38f38164;hpb=b8b6a251c372b134e66d0f436bf2c6231cc1c055;p=nfs-utils.git diff --git a/utils/mount/nfsumount.c b/utils/mount/nfsumount.c index 81d0d3a..b9737be 100644 --- a/utils/mount/nfsumount.c +++ b/utils/mount/nfsumount.c @@ -341,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); @@ -353,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) @@ -370,12 +375,11 @@ int nfsumount(int argc, char *argv[]) ret = 0; if (mc) { if (!lazy) - ret = _nfsumount(mc->m.mnt_fsname, mc->m.mnt_opts); - if(ret) - ret = del_mtab(mc->m.mnt_fsname, mc->m.mnt_dir); + _nfsumount(mc->m.mnt_fsname, mc->m.mnt_opts); + ret = del_mtab(mc->m.mnt_fsname, mc->m.mnt_dir); } else if (*spec != '/') { if (!lazy) - ret = _nfsumount(spec, "tcp,v3"); + _nfsumount(spec, "tcp,v3"); } else ret = del_mtab(NULL, spec);