diff options
author | NeilBrown <neilb@suse.com> | 2016-12-17 12:38:13 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2016-12-20 13:29:04 -0500 |
commit | d0999f6a4a1ac69317692a33c4796df023cb16d5 (patch) | |
tree | 0eb8b1fb055e0c26ec1e49a425224e104966868a /support/nfs | |
parent | 232185c5250337ede03357b82ef89b7983d5d754 (diff) | |
download | nfs-utils-d0999f6a4a1ac69317692a33c4796df023cb16d5.tar.gz nfs-utils-d0999f6a4a1ac69317692a33c4796df023cb16d5.tar.xz nfs-utils-d0999f6a4a1ac69317692a33c4796df023cb16d5.zip |
conffile: allow embedded spaces in values.
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@suse.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'support/nfs')
-rw-r--r-- | support/nfs/conffile.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/support/nfs/conffile.c b/support/nfs/conffile.c index e4f685c..57f58a2 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 |