patch: Fix to bug in simple_strtoul()

Dave Cinege (dcinege@psychosis.com)
Thu, 15 Jan 1998 07:21:11 -0500


Kernel: both 2.0 and 2.1 as far back as I can see.
File: linux/lib/vsprintf.c
Fixes: Skips any leading spaces from the input string, like the real strto*
Example:

Original -
x = simple_strtoul(" 20",NULL, 10);
x == 0 " 20" is disgarded

Patched -
x = simple_strtoul(" 20",NULL,10);
x == 20 " 20" is first trimmed to "20"

Sorry, I didn't feel 3 lines was diff worthy : >

unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base)
{
unsigned long result = 0,value;

+ while (*cp == ' ') {
+ cp++;
+ }
if (!base) {
base = 10;
if (*cp == '0') {