libnfs.a: fix a bug when parse section's arg
Subsystems (2)
PATCH 1/1 libnfs.a: fix a bug when parse section's arg
When parsing section's arg at configure file, the pointer should stop when fetch ']', and give the warning message.
--- support/nfs/conffile.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
support/nfs/conffile.c +2 -2
@@ -271,9 +271,9 @@ conf_parse_line(int trans, char *line, size_t sz)if (ptr ==NULL )return ; line = ++ptr; -while (*ptr && *ptr !='"' ) +while (*ptr && *ptr !='"' && *ptr !=']' ) ptr++; -if (*ptr =='\0' ) { +if (*ptr =='\0' || *ptr ==']' ) {xlog_warn ("config file error: line %d: " "non-matched '\"', ignoring until next section" , ln); }else {
Signature · 1 line
1.7.0.1
When parsing section's arg at configure file, the pointer should stop when fetch ']', and give the warning message.
--- support/nfs/conffile.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
support/nfs/conffile.c +2 -2
@@ -271,9 +271,9 @@ conf_parse_line(int trans, char *line, size_t sz)if (ptr ==NULL )return ; line = ++ptr; -while (*ptr && *ptr !='"' ) +while (*ptr && *ptr !='"' && *ptr !=']' ) ptr++; -if (*ptr =='\0' ) { +if (*ptr =='\0' || *ptr ==']' ) {xlog_warn ("config file error: line %d: " "non-matched '\"', ignoring until next section" , ln); }else {
-- 1.7.0.1
Quoted 15 lines · Mi Jinlong
When parsing section's arg at configure file, the pointer should stop when fetch ']', and give the warning message.
Signed-off-by Mi Jinlong <[email protected]>--- support/nfs/conffile.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)support/nfs/conffile.c +0
-0@@ -271,9 +271,9 @@ conf_parse_line(int trans, char *line, size_t sz)if (ptr ==NULL )
support/nfs/conffile.c conf_parse_line(int trans, char *line, size_t sz) · line 279
Quoted 10 lines
support/nfs/conffile.c +2
-2return ; line = ++ptr; -while (*ptr && *ptr !='"' ) +while (*ptr && *ptr !='"' && *ptr !=']' ) ptr++; -if (*ptr =='\0' ) { +if (*ptr =='\0' || *ptr ==']' ) {xlog_warn ("config file error: line %d: " "non-matched '\"', ignoring until next section" , ln); }else {
I'm not seeing how this helps... I realize that with this patch we are saving the processing of a character or two... but what problem is this patch solving?
steved.
Steve Dickson :
Quoted 20 lines · Mi Jinlong
Quoted 19 lines
When parsing section's arg at configure file, the pointer should stop when fetch ']', and give the warning message.
Signed-off-by Mi Jinlong <[email protected]>--- support/nfs/conffile.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)support/nfs/conffile.c +1
-1@@ -271,9 +271,9 @@ conf_parse_line(int trans, char *line, size_t sz)if (ptr ==NULL )return ; line = ++ptr; -while (*ptr && *ptr !='"' ) +while (*ptr && *ptr !='"' && *ptr !=']' ) ptr++;
Quoted 8 lines
support/nfs/conffile.c conf_parse_line(int trans, char *line, size_t sz) · line 279
Quoted 5 lines
support/nfs/conffile.c +1
-1-if (*ptr =='\0' ) { +if (*ptr =='\0' || *ptr ==']' ) {xlog_warn ("config file error: line %d: " "non-matched '\"', ignoring until next section" , ln); }else {I'm not seeing how this helps... I realize that with this patch we are saving the processing of a character or two... but what problem is this patch solving?
If user sets the section message as [ MountPoint "Mount_point ]" for some mistake, the function should print the warning message, but it continues with argument is "Mount_point ]".
After this patch, the function can process this problem correctly.
thanks,
Mi Jinlong
Quoted 32 lines · Mi Jinlong
Steve Dickson :
Quoted 20 lines · Mi Jinlong
Quoted 19 lines
When parsing section's arg at configure file, the pointer should stop when fetch ']', and give the warning message.
Signed-off-by Mi Jinlong <[email protected]>--- support/nfs/conffile.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)support/nfs/conffile.c +1
-1@@ -271,9 +271,9 @@ conf_parse_line(int trans, char *line, size_t sz)if (ptr ==NULL )return ; line = ++ptr; -while (*ptr && *ptr !='"' ) +while (*ptr && *ptr !='"' && *ptr !=']' ) ptr++;Quoted 8 lines
support/nfs/conffile.c conf_parse_line(int trans, char *line, size_t sz) · line 279
Quoted 5 lines
support/nfs/conffile.c +1
-1-if (*ptr =='\0' ) { +if (*ptr =='\0' || *ptr ==']' ) {xlog_warn ("config file error: line %d: " "non-matched '\"', ignoring until next section" , ln); }else {I'm not seeing how this helps... I realize that with this patch we are saving the processing of a character or two... but what problem is this patch solving?
Quoted 5 lines
If user sets the section message as [ MountPoint "
Mount_point]" for some mistake, the function should print the warning message, but it continues with argument is "Mount_point]".After this patch, the function can process this problem correctly.
Ok... I see the problem now... Thanks!
steved.
Quoted 4 lines
thanks,
Mi Jinlong
Quoted 13 lines · Mi Jinlong
When parsing section's arg at configure file, the pointer should stop when fetch ']', and give the warning message.
--- support/nfs/conffile.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)support/nfs/conffile.c +0
-0@@ -271,9 +271,9 @@ conf_parse_line(int trans, char *line, size_t sz)if (ptr ==NULL )
support/nfs/conffile.c conf_parse_line(int trans, char *line, size_t sz) · line 279
Quoted 10 lines
support/nfs/conffile.c +2
-2return ; line = ++ptr; -while (*ptr && *ptr !='"' ) +while (*ptr && *ptr !='"' && *ptr !=']' ) ptr++; -if (*ptr =='\0' ) { +if (*ptr =='\0' || *ptr ==']' ) {xlog_warn ("config file error: line %d: " "non-matched '\"', ignoring until next section" , ln); }else {
Committed...
steved.