X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Fnfs4mount.c;h=028e7cd5447e16a8b20e50efa67ec703cca3f3d6;hp=2b0fe2e30c50de63b1a2c92b2ef69440e6760c06;hb=014e00dfaea0efc92150e2aedc5ca43aa337545e;hpb=281ca299724f24e7b19c1eca04bba03410e2a306 diff --git a/utils/mount/nfs4mount.c b/utils/mount/nfs4mount.c index 2b0fe2e..028e7cd 100644 --- a/utils/mount/nfs4mount.c +++ b/utils/mount/nfs4mount.c @@ -34,6 +34,7 @@ #include #include #include + #ifdef HAVE_RPCSVC_NFS_PROT_H #include #else @@ -45,6 +46,7 @@ #include "nls.h" #include "xcommon.h" +#include "mount.h" #include "mount_constants.h" #include "nfs4_mount.h" #include "nfs_mount.h" @@ -144,7 +146,7 @@ static int fill_ipv4_sockaddr(const char *hostname, struct sockaddr_in *addr) progname, hostname); return -1; } - if (hp->h_length > sizeof(struct in_addr)) { + if (hp->h_length > (int)sizeof(struct in_addr)) { nfs_error(_("%s: got bad hp->h_length"), progname); hp->h_length = sizeof(struct in_addr); } @@ -215,8 +217,11 @@ int nfs4mount(const char *spec, const char *node, int flags, progname); goto fail; } - snprintf(new_opts, sizeof(new_opts), "%s%saddr=%s", - old_opts, *old_opts ? "," : "", s); + if (running_bg) + strncpy(new_opts, old_opts, sizeof(new_opts)); + else + snprintf(new_opts, sizeof(new_opts), "%s%saddr=%s", + old_opts, *old_opts ? "," : "", s); *extra_opts = xstrdup(new_opts); /* Set default options. @@ -432,15 +437,17 @@ int nfs4mount(const char *spec, const char *node, int flags, break; } - switch(rpc_createerr.cf_stat){ - case RPC_TIMEDOUT: - break; - case RPC_SYSTEMERROR: - if (errno == ETIMEDOUT) + if (!bg) { + switch(rpc_createerr.cf_stat) { + case RPC_TIMEDOUT: break; - default: - rpc_mount_errors(hostname, 0, bg); - goto fail; + case RPC_SYSTEMERROR: + if (errno == ETIMEDOUT) + break; + default: + rpc_mount_errors(hostname, 0, bg); + goto fail; + } } if (bg && !running_bg) {