[PATCH 05/10] conffile: allow embedded spaces in values.

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

 



The code that said "Skip trailing spaces" actually skipped everything
after the first space.

Change to to only skip trailing spaces, or comments that start after
a space.

This is useful for lists:
   Foo: a, b, c

The list handling already allows for internal spaces.

Signed-off-by: NeilBrown <neilb@xxxxxxxx>
---
 support/nfs/conffile.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c
index e4f685c558fa..57f58a2bcdc7 100644
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -308,14 +308,18 @@ conf_parse_line(int trans, char *line, size_t sz)
 				line ++;
 				j = strcspn(line, "'");
 				line[j] = 0;
-			} else
+			} else {
 				/* Skip trailing spaces and comments */
 				for (j = 0; val[j]; j++) {
-					if (val[j] == '#' || val[j] == ';' || isspace(val[j])) {
+					if ((val[j] == '#' || val[j] == ';')
+					    && (j == 0 || isspace(val[j-1]))) {
 						val[j] = '\0';
 						break;
 					}
 				}
+				while (j && isspace(val[j-1]))
+					val[--j] = '\0';
+			}
 			if (strcasecmp(line, "include") == 0)
 				conf_load(trans, val);
 			else


--
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