X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Fnfsmount.c;h=1298fe44485789bae59cc10cf7430c2599b4f5a5;hp=6355681d4b520eeb3bdeacb26ed81cf797ea33cc;hb=12544486ef2de86e4f2dfc920cd2860fb81658d1;hpb=8dfb9661a132a206c10067f40e274cf797dab1b2 diff --git a/utils/mount/nfsmount.c b/utils/mount/nfsmount.c index 6355681..1298fe4 100644 --- a/utils/mount/nfsmount.c +++ b/utils/mount/nfsmount.c @@ -21,7 +21,7 @@ * Wed Oct 1 23:55:28 1997: Dick Streefland * Implemented the "bg", "fg" and "retry" mount options for NFS. * - * 1999-02-22 Arkadiusz Mi¶kiewicz + * 1999-02-22 Arkadiusz Miskiewicz * - added Native Language Support * * Modified by Olaf Kirch and Trond Myklebust for new NFS code, @@ -170,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; @@ -179,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 == '"') @@ -457,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; } @@ -507,8 +510,12 @@ nfsmount(const char *spec, const char *node, int flags, int val; static int doonce = 0; - clnt_addr_t mnt_server = { &mounthost, }; - clnt_addr_t nfs_server = { &hostname, }; + clnt_addr_t mnt_server = { + .hostname = &mounthost + }; + clnt_addr_t nfs_server = { + .hostname = &hostname + }; struct sockaddr_in *nfs_saddr = &nfs_server.saddr; struct pmap *mnt_pmap = &mnt_server.pmap, *nfs_pmap = &nfs_server.pmap;