diff options
author | Michael Holzheu <holzheu@de.ibm.com> | 2006-10-28 13:38:47 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-28 14:30:54 -0400 |
commit | 6e6d9fa6f95e382bb2d5725dda18b9e811418e79 (patch) | |
tree | 911e52a81653140ae74bebdad2ce367ccf3c7889 /lib | |
parent | 5fa3839a64203b2ab727dcb37da9b2d7079fca28 (diff) |
[PATCH] strstrip remove last blank fix
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@de.ibm.com>
Signed-off-by: Michael Holzheu <holzheu@de.ibm.com>
Acked-by: Pekka Enberg <penberg@cs.helsinki.fi>
Acked-by Joern Engel <joern@wh.fh-wedel.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/string.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/string.c b/lib/string.c index 63077267367e..a485d75962af 100644 --- a/lib/string.c +++ b/lib/string.c | |||
@@ -320,7 +320,7 @@ char *strstrip(char *s) | |||
320 | return s; | 320 | return s; |
321 | 321 | ||
322 | end = s + size - 1; | 322 | end = s + size - 1; |
323 | while (end != s && isspace(*end)) | 323 | while (end >= s && isspace(*end)) |
324 | end--; | 324 | end--; |
325 | *(end + 1) = '\0'; | 325 | *(end + 1) = '\0'; |
326 | 326 | ||