Fix failure to strip end of line with comment
authorJens Axboe <jens.axboe@oracle.com>
Fri, 6 Mar 2009 19:29:29 +0000 (20:29 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Fri, 6 Mar 2009 19:29:29 +0000 (20:29 +0100)
We left a space at the end, which confused the postfix checking.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
parse.c

diff --git a/parse.c b/parse.c
index f838a1f625e111f6aa55a5bdf221a4f6352319a4..d653f5e489458236a6d441a1157fab15396314ed 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -152,7 +152,7 @@ void strip_blank_front(char **p)
 
 void strip_blank_end(char *p)
 {
 
 void strip_blank_end(char *p)
 {
-       char *s;
+       char *start = p, *s;
 
        s = strchr(p, ';');
        if (s)
 
        s = strchr(p, ';');
        if (s)
@@ -164,7 +164,7 @@ void strip_blank_end(char *p)
                p = s;
 
        s = p + strlen(p);
                p = s;
 
        s = p + strlen(p);
-       while ((isspace(*s) || iscntrl(*s)) && (s > p))
+       while ((isspace(*s) || iscntrl(*s)) && (s > start))
                s--;
 
        *(s + 1) = '\0';
                s--;
 
        *(s + 1) = '\0';