Author: rjung Date: Fri Oct 15 16:59:40 2010 New Revision: 1023020 URL: http://svn.apache.org/viewvc?rev=1023020&view=rev Log: Fix test that returns always true.
Only a problem, if the token to trim were actually empty. Modified: tomcat/jk/trunk/native/common/jk_map.c Modified: tomcat/jk/trunk/native/common/jk_map.c URL: http://svn.apache.org/viewvc/tomcat/jk/trunk/native/common/jk_map.c?rev=1023020&r1=1023019&r2=1023020&view=diff ============================================================================== --- tomcat/jk/trunk/native/common/jk_map.c (original) +++ tomcat/jk/trunk/native/common/jk_map.c Fri Oct 15 16:59:40 2010 @@ -634,10 +634,13 @@ static size_t trim(char *s) /* check for empty strings */ if (!(i = strlen(s))) return 0; - for (i = i - 1; (i >= 0) && + for (i = i - 1; (i > 0) && isspace((int)((unsigned char)s[i])); i--); + if ((i > 0) || !isspace((int)((unsigned char)s[i]))) { + i++; + } - s[i + 1] = '\0'; + s[i] = '\0'; for (i = 0; ('\0' != s[i]) && isspace((int)((unsigned char)s[i])); i++); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org