aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--util-linux/nfsmount.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c
index 34f23f5aa..0ebab80f6 100644
--- a/util-linux/nfsmount.c
+++ b/util-linux/nfsmount.c
@@ -315,7 +315,7 @@ int nfsmount(const char *spec, const char *node, int *flags,
315 char new_opts[1024]; 315 char new_opts[1024];
316 struct timeval total_timeout; 316 struct timeval total_timeout;
317 enum clnt_stat clnt_stat; 317 enum clnt_stat clnt_stat;
318 static struct nfs_mount_data data; 318 struct nfs_mount_data data;
319 char *opt, *opteq; 319 char *opt, *opteq;
320 int val; 320 int val;
321 struct hostent *hp; 321 struct hostent *hp;
@@ -602,10 +602,9 @@ int nfsmount(const char *spec, const char *node, int *flags,
602#endif 602#endif
603 603
604 data.version = nfs_mount_version; 604 data.version = nfs_mount_version;
605 *mount_opts = (char *) &data;
606 605
607 if (*flags & MS_REMOUNT) 606 if (*flags & MS_REMOUNT)
608 return 0; 607 goto copy_data_and_return;
609 608
610 /* 609 /*
611 * If the previous mount operation on the same host was 610 * If the previous mount operation on the same host was
@@ -857,6 +856,9 @@ int nfsmount(const char *spec, const char *node, int *flags,
857 auth_destroy(mclient->cl_auth); 856 auth_destroy(mclient->cl_auth);
858 clnt_destroy(mclient); 857 clnt_destroy(mclient);
859 close(msock); 858 close(msock);
859copy_data_and_return:
860 *mount_opts = xrealloc(*mount_opts, sizeof(data));
861 memcpy(*mount_opts, &data, sizeof(data));
860 return 0; 862 return 0;
861 863
862 /* abort */ 864 /* abort */