summaryrefslogtreecommitdiff
path: root/lib/parser.c
diff options
context:
space:
mode:
authorHirofumi Ogawa <hirofumi@mail.parknet.co.jp>2003-10-05 21:02:22 -0700
committerLinus Torvalds <torvalds@home.osdl.org>2003-10-05 21:02:22 -0700
commit13ea5e83c74ab3c26789882deadc86fc64e4d432 (patch)
tree50857072e617166c058b121323cc86ba35d225be /lib/parser.c
parent5163200e20bfe8cd43570a82fb29398dfce3a50c (diff)
[PATCH] lib/parser: Not recognize nul string as "%s" (6/6)
Current match_token recognize "foo=" as "foo=%s". So this change the nul string does not recognize as "%s".
Diffstat (limited to 'lib/parser.c')
-rw-r--r--lib/parser.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/parser.c b/lib/parser.c
index 858061397fe2..790ec2a858d7 100644
--- a/lib/parser.c
+++ b/lib/parser.c
@@ -45,7 +45,9 @@ static int match_one(char *s, char *p, substring_t args[])
args[argc].from = s;
switch (*p++) {
case 's':
- if (len == -1 || len > strlen(s))
+ if (strlen(s) == 0)
+ return 0;
+ else if (len == -1 || len > strlen(s))
len = strlen(s);
args[argc].to = s + len;
break;