From: Steve Dickson <SteveD@redhat.com>
To: Tony Asleson <tasleson@redhat.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 1/3] exportfs.c: escape path for function test_export
Date: Tue, 07 Jan 2014 16:02:27 -0500 [thread overview]
Message-ID: <52CC6B63.2000808@RedHat.com> (raw)
In-Reply-To: <1387397189-9591-1-git-send-email-tasleson@redhat.com>
On 18/12/13 15:06, Tony Asleson wrote:
> Verbatim patch proposal from J. Bruce Fields except calling
> snprintf instead of sprintf.
>
> Tested and appears to work with path names that have a space.
>
> Signed-off-by: Tony Asleson <tasleson@redhat.com>
All three committed...
steved.
> ---
> utils/exportfs/exportfs.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
> index 00667e9..3ca45c1 100644
> --- a/utils/exportfs/exportfs.c
> +++ b/utils/exportfs/exportfs.c
> @@ -444,11 +444,15 @@ static int can_test(void)
> static int test_export(char *path, int with_fsid)
> {
> char buf[1024];
> + char *bp = buf;
> + int len = sizeof(buf);
> int fd, n;
>
> - sprintf(buf, "-test-client- %s 3 %d 65534 65534 0\n",
> - path,
> - with_fsid ? NFSEXP_FSID : 0);
> + n = snprintf(buf, len, "-test-client- ");
> + bp += n;
> + len -= n;
> + qword_add(&bp, &len, path);
> + snprintf(bp, len, " 3 %d 65534 65534 0\n", with_fsid ? NFSEXP_FSID : 0);
> fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY);
> if (fd < 0)
> return 0;
>
prev parent reply other threads:[~2014-01-07 21:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-18 20:06 [PATCH 1/3] exportfs.c: escape path for function test_export Tony Asleson
2013-12-18 20:06 ` [PATCH 2/3] exportfs.c: Remove trailing whitespace Tony Asleson
2013-12-18 20:06 ` [PATCH 3/3] exportfs.c: Escape path for '-s' option Tony Asleson
2014-01-07 21:02 ` Steve Dickson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52CC6B63.2000808@RedHat.com \
--to=steved@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=tasleson@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).