[PATCH 3/3] exportfs.c: Escape path for '-s' option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When outputing the paths and the user has specified the option
-s, escape the path.

Signed-off-by: Tony Asleson <tasleson@xxxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux