Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 0eec05715da3ca8ae3817a0833b18fa6 > files > 24

nfs-utils-1.0.9-50.el5.src.rpm

diff -up nfs-utils-1.0.9/utils/mount/mount.c.orig nfs-utils-1.0.9/utils/mount/mount.c
--- nfs-utils-1.0.9/utils/mount/mount.c.orig	2010-08-02 08:48:04.000000000 -0400
+++ nfs-utils-1.0.9/utils/mount/mount.c	2010-08-02 08:49:01.000000000 -0400
@@ -558,6 +558,7 @@ int main(int argc, char *argv[])
 	if (mnt_err == EX_BG) {
 		if (verbose) {
 			printf("%s: backgrounding \"%s\"\n", progname, spec);
+			printf("%s: mount options: %s\n", progname, extra_opts);
 			fflush(stdout);
 		}
 		/*
diff -up nfs-utils-1.0.9/utils/mount/nfs4mount.c.orig nfs-utils-1.0.9/utils/mount/nfs4mount.c
--- nfs-utils-1.0.9/utils/mount/nfs4mount.c.orig	2010-08-02 08:48:04.000000000 -0400
+++ nfs-utils-1.0.9/utils/mount/nfs4mount.c	2010-08-02 08:48:36.000000000 -0400
@@ -211,8 +211,11 @@ int nfs4mount(const char *spec, const ch
 				  "excessively long option argument\n"));
 		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.
@@ -421,15 +424,17 @@ int nfs4mount(const char *spec, const ch
 			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:
-			mount_errors(hostname, 0, bg);
-			goto fail;
+			case RPC_SYSTEMERROR:
+				if (errno == ETIMEDOUT)
+					break;
+			default:
+				mount_errors(hostname, 0, bg);
+				goto fail;
+			}
 		}
 
 		if (bg && !running_bg) {
diff -up nfs-utils-1.0.9/utils/mount/nfsmount.c.orig nfs-utils-1.0.9/utils/mount/nfsmount.c
--- nfs-utils-1.0.9/utils/mount/nfsmount.c.orig	2010-08-02 08:48:04.000000000 -0400
+++ nfs-utils-1.0.9/utils/mount/nfsmount.c	2010-08-02 08:49:01.000000000 -0400
@@ -548,7 +548,7 @@ parse_options(char *old_opts, struct nfs
 	struct pmap *mnt_pmap = &mnt_server->pmap;
 	struct pmap *nfs_pmap = &nfs_server->pmap;
 	int len;
-	char *opt, *opteq, *p, *opt_b;
+	char *opt, *opteq, *p, *opt_b, *tmp_opts;
 	char *mounthost = NULL;
 	char cbuf[128];
 	int open_quote = 0;
@@ -556,8 +556,9 @@ parse_options(char *old_opts, struct nfs
 	data->flags = 0;
 	*bg = 0;
 
+	tmp_opts = xstrdup(old_opts);
 	len = strlen(new_opts);
-	for (p=old_opts, opt_b=NULL; p && *p; p++) {
+	for (p=tmp_opts, opt_b=NULL; p && *p; p++) {
 		if (!opt_b)
 			opt_b = p;		/* begin of the option item */
 		if (*p == '"') 
@@ -833,10 +834,12 @@ parse_options(char *old_opts, struct nfs
 			goto out_bad;
 		*mnt_server->hostname = mounthost;
 	}
+	free(tmp_opts);
 	return 1;
  bad_parameter:
 	printf(_("Bad nfs mount parameter: %s\n"), opt);
  out_bad:
+	free(tmp_opts);
 	return 0;
 }
 
@@ -1003,7 +1006,6 @@ nfsmount(const char *spec, const char *n
 #endif
 
 	data.version = nfs_mount_version;
-	*mount_opts = (char *) &data;
 
 	if (*flags & MS_REMOUNT)
 		goto out_ok;
@@ -1214,6 +1216,7 @@ noauth_flavors:
 	snprintf(cbuf, sizeof(cbuf)-1, "addr=%s", s);
 	strcat(new_opts, cbuf);
 
+	*mount_opts = (char *) &data;
 	*extra_opts = xstrdup(new_opts);
 	return 0;