]> git.decadent.org.uk Git - nfs-utils.git/blobdiff - utils/mount/nfsmount.c
NFS man page: update nfs(5) with details about IPv6 support
[nfs-utils.git] / utils / mount / nfsmount.c
index b343a1f07a216643f11a5ef3aec9614735a31014..6b3356c05efe57d6a7ee0efeac665c530c2446ad 100644 (file)
 #include "network.h"
 #include "version.h"
 
+#ifdef HAVE_RPCSVC_NFS_PROT_H
+#include <rpcsvc/nfs_prot.h>
+#else
+#include <linux/nfs.h>
+#define nfsstat nfs_stat
+#endif
+
 #ifndef NFS_PORT
 #define NFS_PORT 2049
 #endif
@@ -163,7 +170,7 @@ parse_options(char *old_opts, struct nfs_mount_data *data,
        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;
@@ -172,7 +179,8 @@ parse_options(char *old_opts, struct nfs_mount_data *data,
        *bg = 0;
 
        len = strlen(new_opts);
-       for (p=old_opts, opt_b=NULL; p && *p; p++) {
+       tmp_opts = xstrdup(old_opts);
+       for (p=tmp_opts, opt_b=NULL; p && *p; p++) {
                if (!opt_b)
                        opt_b = p;              /* begin of the option item */
                if (*p == '"')
@@ -450,10 +458,12 @@ parse_options(char *old_opts, struct nfs_mount_data *data,
                        goto out_bad;
                *mnt_server->hostname = mounthost;
        }
+       free(tmp_opts);
        return 1;
  bad_parameter:
        nfs_error(_("%s: Bad nfs mount parameter: %s\n"), progname, opt);
  out_bad:
+       free(tmp_opts);
        return 0;
 }