From d79455dbd3dfde28e41574786afd0f71a38df746 Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Fri, 28 Sep 2007 16:36:51 -0400 Subject: [PATCH] text-based mount.nfs: add parser init and destroy calls Introduce parser init and destroy calls in the main text-based mount handling routines. Don't actually use the parsed option object yet. Signed-off-by: Chuck Lever Signed-off-by: Neil Brown --- utils/mount/stropts.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 4dbd19e..bdc8f2c 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -305,6 +305,7 @@ static int append_clientaddr_option(struct sockaddr_in *saddr, int nfsmount_s(const char *spec, const char *node, int flags, char **extra_opts, int fake, int child) { + struct mount_options *options = NULL; struct sockaddr_in saddr; char *hostname; int err, retval = EX_FAIL; @@ -318,6 +319,12 @@ int nfsmount_s(const char *spec, const char *node, int flags, extract_interesting_options(*extra_opts); + options = po_split(*extra_opts); + if (!options) { + nfs_error(_("%s: internal option parsing error"), progname); + goto out; + } + if (!child && addr_opt) { nfs_error(_("%s: Illegal option: 'addr='"), progname); goto out; @@ -326,6 +333,11 @@ int nfsmount_s(const char *spec, const char *node, int flags, if (!append_addr_opt(&saddr, extra_opts)) goto out; + if (po_join(options, extra_opts) == PO_FAILED) { + nfs_error(_("%s: internal option parsing error"), progname); + goto out; + } + if (verbose) printf(_("%s: text-based options: '%s'\n"), progname, *extra_opts); @@ -341,6 +353,7 @@ int nfsmount_s(const char *spec, const char *node, int flags, retval = EX_SUCCESS; out: + po_destroy(options); return retval; } @@ -361,6 +374,7 @@ out: int nfs4mount_s(const char *spec, const char *node, int flags, char **extra_opts, int fake, int child) { + struct mount_options *options = NULL; struct sockaddr_in saddr; char *hostname; int err, retval = EX_FAIL; @@ -374,6 +388,12 @@ int nfs4mount_s(const char *spec, const char *node, int flags, extract_interesting_options(*extra_opts); + options = po_split(*extra_opts); + if (!options) { + nfs_error(_("%s: internal option parsing error"), progname); + goto out; + } + if (addr_opt) { nfs_error(_("%s: Illegal option: 'addr='"), progname); goto out; @@ -385,6 +405,11 @@ int nfs4mount_s(const char *spec, const char *node, int flags, if (!ca_opt && !append_clientaddr_opt(&saddr, extra_opts)) goto out; + if (po_join(options, extra_opts) == PO_FAILED) { + nfs_error(_("%s: internal option parsing error"), progname); + goto out; + } + if (verbose) printf(_("%s: text-based options: '%s'\n"), progname, *extra_opts); @@ -400,5 +425,6 @@ int nfs4mount_s(const char *spec, const char *node, int flags, retval = EX_SUCCESS; out: + po_destroy(options); return retval; } -- 2.39.5