s/extern inline/static ATTRIBUTE_ALWAYS_INLINE/g
xstrtou: disallow leading '+'
This commit is contained in:
@@ -447,7 +447,6 @@ getopt32(int argc, char **argv, const char *applet_opts, ...)
|
||||
}
|
||||
va_end (p);
|
||||
|
||||
#if ENABLE_AR || ENABLE_TAR
|
||||
if (spec_flgs & FIRST_ARGV_IS_OPT) {
|
||||
if (argv[1] && argv[1][0] != '-' && argv[1][0] != '\0') {
|
||||
argv[1] = xasprintf("-%s", argv[1]);
|
||||
@@ -455,7 +454,6 @@ getopt32(int argc, char **argv, const char *applet_opts, ...)
|
||||
spec_flgs |= FREE_FIRST_ARGV_IS_OPT;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* Note: just "getopt() <= 0" will not work good for
|
||||
* "fake" short options, like this one:
|
||||
* wget $'-\203' "Test: test" http://kernel.org/
|
||||
|
||||
@@ -34,7 +34,8 @@
|
||||
#endif
|
||||
|
||||
#if UINT_MAX != ULONG_MAX
|
||||
extern inline unsigned bb_strtoui(const char *str, char **end, int b)
|
||||
static ATTRIBUTE_ALWAYS_INLINE
|
||||
unsigned bb_strtoui(const char *str, char **end, int b)
|
||||
{
|
||||
unsigned long v = strtoul(str, end, b);
|
||||
if (v > UINT_MAX) {
|
||||
|
||||
@@ -24,7 +24,7 @@ unsigned type xstrtou(_range_sfx)(const char *numstr, int base,
|
||||
/* Disallow '-' and any leading whitespace. Speed isn't critical here
|
||||
* since we're parsing commandline args. So make sure we get the
|
||||
* actual isspace function rather than a lnumstrer macro implementaion. */
|
||||
if ((*numstr == '-') || (isspace)(*numstr))
|
||||
if (*numstr == '-' || *numstr == '+' || (isspace)(*numstr))
|
||||
goto inval;
|
||||
|
||||
/* Since this is a lib function, we're not allowed to reset errno to 0.
|
||||
@@ -36,7 +36,7 @@ unsigned type xstrtou(_range_sfx)(const char *numstr, int base,
|
||||
/* Do the initial validity check. Note: The standards do not
|
||||
* guarantee that errno is set if no digits were found. So we
|
||||
* must test for this explicitly. */
|
||||
if (errno || (numstr == e))
|
||||
if (errno || numstr == e)
|
||||
goto inval; /* error / no digits / illegal trailing chars */
|
||||
|
||||
errno = old_errno; /* Ok. So restore errno. */
|
||||
@@ -127,7 +127,7 @@ type xstrto(_range_sfx)(const char *numstr, int base,
|
||||
type r;
|
||||
const char *p = numstr;
|
||||
|
||||
if ((p[0] == '-') && (p[1] != '+')) {
|
||||
if (p[0] == '-') {
|
||||
++p;
|
||||
++u; /* two's complement */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user