diff options
Diffstat (limited to 'coreutils/printf.c')
-rw-r--r-- | coreutils/printf.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/coreutils/printf.c b/coreutils/printf.c index b2429c5cf..67d3b2eda 100644 --- a/coreutils/printf.c +++ b/coreutils/printf.c | |||
@@ -95,6 +95,12 @@ static int multiconvert(const char *arg, void *result, converter convert) | |||
95 | 95 | ||
96 | static void FAST_FUNC conv_strtoull(const char *arg, void *result) | 96 | static void FAST_FUNC conv_strtoull(const char *arg, void *result) |
97 | { | 97 | { |
98 | /* Allow leading '+' - bb_strtoull() by itself does not allow it, | ||
99 | * and probably shouldn't (other callers might require purely numeric | ||
100 | * inputs to be allowed. | ||
101 | */ | ||
102 | if (arg[0] == '+') | ||
103 | arg++; | ||
98 | *(unsigned long long*)result = bb_strtoull(arg, NULL, 0); | 104 | *(unsigned long long*)result = bb_strtoull(arg, NULL, 0); |
99 | /* both coreutils 6.10 and bash 3.2: | 105 | /* both coreutils 6.10 and bash 3.2: |
100 | * $ printf '%x\n' -2 | 106 | * $ printf '%x\n' -2 |
@@ -107,6 +113,8 @@ static void FAST_FUNC conv_strtoull(const char *arg, void *result) | |||
107 | } | 113 | } |
108 | static void FAST_FUNC conv_strtoll(const char *arg, void *result) | 114 | static void FAST_FUNC conv_strtoll(const char *arg, void *result) |
109 | { | 115 | { |
116 | if (arg[0] == '+') | ||
117 | arg++; | ||
110 | *(long long*)result = bb_strtoll(arg, NULL, 0); | 118 | *(long long*)result = bb_strtoll(arg, NULL, 0); |
111 | } | 119 | } |
112 | static void FAST_FUNC conv_strtod(const char *arg, void *result) | 120 | static void FAST_FUNC conv_strtod(const char *arg, void *result) |