From: Tony Asleson <tasleson@redhat.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 3/3] exportfs.c: Escape path for '-s' option
Date: Wed, 18 Dec 2013 14:06:29 -0600 [thread overview]
Message-ID: <1387397189-9591-3-git-send-email-tasleson@redhat.com> (raw)
In-Reply-To: <1387397189-9591-1-git-send-email-tasleson@redhat.com>
When outputing the paths and the user has specified the option
-s, escape the path.
Signed-off-by: Tony Asleson <tasleson@redhat.com>
---
utils/exportfs/exportfs.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index 019961b..9ea86cb 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -666,6 +666,9 @@ dumpopt(char c, char *fmt, ...)
static void
dump(int verbose, int export_format)
{
+ char buf[1024];
+ char *bp;
+ int len;
nfs_export *exp;
struct exportent *ep;
int htype;
@@ -683,7 +686,15 @@ dump(int verbose, int export_format)
if (strlen(ep->e_path) > 14 && !export_format)
printf("%-14s\n\t\t%s", ep->e_path, hname);
else
- printf(((export_format)? "%s %s" : "%-14s\t%s"), ep->e_path, hname);
+ if (export_format) {
+ bp = buf;
+ len = sizeof(buf) - 1;
+ qword_add(&bp, &len, ep->e_path);
+ *bp = '\0';
+ printf("%s %s", buf, hname);
+ } else {
+ printf("%-14s\t%s", ep->e_path, hname);
+ }
if (!verbose && !export_format) {
printf("\n");
--
1.8.2.1
next prev parent reply other threads:[~2013-12-18 20:06 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 ` Tony Asleson [this message]
2014-01-07 21:02 ` [PATCH 1/3] exportfs.c: escape path for function test_export Steve Dickson
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=1387397189-9591-3-git-send-email-tasleson@redhat.com \
--to=tasleson@redhat.com \
--cc=linux-nfs@vger.kernel.org \
/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).