[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20061026130703.6f8cc0bd.holzheu@de.ibm.com>
Date: Thu, 26 Oct 2006 13:07:03 +0200
From: Michael Holzheu <holzheu@...ibm.com>
To: penberg@...helsinki.fi
Cc: linux-kernel@...r.kernel.org, akpm@...l.org,
joern@...nheim.fh-wedel.de, schwidefsky@...ibm.com,
ioe-lkml@...eria.de, minyard@....org
Subject: [PATCH] strstrip remove last blank fix
Hi Pekka,
strstrip() does not remove the last blank from strings which only consist
of blanks.
Example:
char string[] = " ";
strstrip(string);
results in " ", but should produce an empty string!
The following patch solves this problem:
Acked-by: Martin Schwidefsky <schwidefsky@...ibm.com>
Signed-off-by: Michael Holzheu <holzheu@...ibm.com>
---
lib/string.c | 2 +-
1 files changed, 1 insertion(+), 1 deletion(-)
diff -Naurp linux-2.6.18/lib/string.c linux-2.6.18-strstrip-fix/lib/string.c
--- linux-2.6.18/lib/string.c 2006-06-19 14:03:20.000000000 +0200
+++ linux-2.6.18-strstrip-fix/lib/string.c 2006-10-25 18:36:08.000000000 +0200
@@ -320,7 +320,7 @@ char *strstrip(char *s)
return s;
end = s + size - 1;
- while (end != s && isspace(*end))
+ while (end >= s && isspace(*end))
end--;
*(end + 1) = '\0';
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists