summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Asleson <tasleson@redhat.com>2014-01-07 15:43:43 -0500
committerSteve Dickson <steved@redhat.com>2014-01-07 15:57:48 -0500
commit9d404c0bc391c6d0294204cd9c7eba032d517013 (patch)
tree3510660ca2ee2ce3502bd9e53d40fb5f08669a08
parentb62a5103ca8dd2c6e128379ab035352ce15886a1 (diff)
downloadnfs-utils-9d404c0bc391c6d0294204cd9c7eba032d517013.tar.gz
nfs-utils-9d404c0bc391c6d0294204cd9c7eba032d517013.tar.xz
nfs-utils-9d404c0bc391c6d0294204cd9c7eba032d517013.zip
exportfs.c: Escape path for '-s' option
When outputing the paths and the user has specified the option -s, escape the path. Signed-off-by: Tony Asleson <tasleson@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--utils/exportfs/exportfs.c13
1 files changed, 12 insertions, 1 deletions
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");