X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Fnfsmount.c;h=89fd4a32f05144530cee2146fef6c649fa3265fd;hp=9c08ff5837b22d4b18115e25a3e948ccade47edb;hb=c7cec7fbd3fc9f46a17519d95b8211cf78e328c0;hpb=0dfc8a5426381c6d65aed4d9d0e50bae3238cc8f diff --git a/utils/mount/nfsmount.c b/utils/mount/nfsmount.c index 9c08ff5..89fd4a3 100644 --- a/utils/mount/nfsmount.c +++ b/utils/mount/nfsmount.c @@ -89,6 +89,7 @@ typedef union { } mntres_t; extern int nfs_mount_data_version; +extern char *progname; extern int verbose; extern int sloppy; @@ -485,9 +486,8 @@ out_bad: } int -nfsmount(const char *spec, const char *node, int *flags, - char **extra_opts, char **mount_opts, - int running_bg, int *need_statd) +nfsmount(const char *spec, const char *node, int flags, + char **extra_opts, int running_bg, int fake) { static char *prev_bg_host; char hostdir[1024]; @@ -617,9 +617,8 @@ nfsmount(const char *spec, const char *node, int *flags, #endif data.version = nfs_mount_data_version; - *mount_opts = (char *) &data; - if (*flags & MS_REMOUNT) + if (flags & MS_REMOUNT) goto out_ok; /* @@ -849,7 +848,26 @@ noauth_flavors: strcat(new_opts, cbuf); *extra_opts = xstrdup(new_opts); - *need_statd = ! (data.flags & NFS_MOUNT_NONLM); + + if (!fake && !(data.flags & NFS_MOUNT_NONLM)) { + if (!start_statd()) { + nfs_error(_("%s: rpc.statd is not running but is " + "required for remote locking.\n" + " Either use '-o nolocks' to keep " + "locks local, or start statd."), + progname); + goto fail; + } + } + + if (!fake) { + if (mount(spec, node, "nfs", + flags & ~(MS_USER|MS_USERS), &data)) { + mount_error(spec, node, errno); + goto fail; + } + } + return 0; /* abort */