From 84c95c9acf088c99d8793d78036b67faa5d0b851 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Goddard=20Rosa?= Date: Mon, 14 Dec 2009 18:01:04 -0800 Subject: [PATCH] string: on strstrip(), first remove leading spaces before running over str MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit ... so that strlen() iterates over a smaller string comprising of the remaining characters only. Signed-off-by: André Goddard Rosa Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- lib/string.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/string.c b/lib/string.c index 3a912a4..765566a 100644 --- a/lib/string.c +++ b/lib/string.c @@ -364,8 +364,8 @@ char *strstrip(char *s) size_t size; char *end; + s = skip_spaces(s); size = strlen(s); - if (!size) return s; @@ -374,7 +374,7 @@ char *strstrip(char *s) end--; *(end + 1) = '\0'; - return skip_spaces(s); + return s; } EXPORT_SYMBOL(strstrip); -- 1.8.2.3