nfs-utils/nfs-utils-1.0.9-lazy-umount.patch

59 lines
1.5 KiB
Diff
Raw Normal View History

--- nfs-utils-1.0.9/utils/mount/nfsumount.c.orig 2006-07-28 11:12:32.000000000 -0400
+++ nfs-utils-1.0.9/utils/mount/nfsumount.c 2006-07-28 11:14:41.000000000 -0400
@@ -100,9 +100,9 @@ int nfs_call_umount(clnt_addr_t *mnt_ser
}
mnt_closeclnt(clnt, msock);
if (res == RPC_SUCCESS)
- return 1;
+ return 0;
out_bad:
- return 0;
+ return 1;
}
u_int get_mntproto(const char *);
@@ -251,9 +251,6 @@ int add_mtab2(const char *spec, const ch
return 1;
}
-/*
- * Returns 1 if everything went well, else 0.
- */
int _nfsumount(const char *spec, const char *opts)
{
char *hostname;
@@ -309,8 +306,8 @@ int _nfsumount(const char *spec, const c
goto out_bad;
return nfs_call_umount(&mnt_server, &dirname);
out_bad:
- fprintf(stderr, "%s: %s: not found or not mounted\n", progname, spec);
- return 0;
+ fprintf(stderr, "%s: %s: not found / mounted or server not reachable\n", progname, spec);
+ return 1;
}
static struct option umount_longopts[] =
@@ -393,14 +390,18 @@ int nfsumount(int argc, char *argv[])
}
}
- ret = _nfsumount(mc->m.mnt_fsname, mc->m.mnt_opts);
- if(ret)
+ ret = 0;
+ if(!force && !lazy)
+ ret = _nfsumount(mc->m.mnt_fsname, mc->m.mnt_opts);
+ if(!ret)
ret = add_mtab2(mc->m.mnt_fsname, mc->m.mnt_dir,
mc->m.mnt_type, mc->m.mnt_opts, mc);
}
else {
- ret = _nfsumount(spec, NULL);
- if(ret)
+ ret = 0;
+ if(!force && !lazy)
+ ret = _nfsumount(spec, NULL);
+ if(!ret)
ret = add_mtab2(spec, spec, spec, spec, NULL);
}