aboutsummaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/printf.c8
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)
static void FAST_FUNC conv_strtoull(const char *arg, void *result)
{
+ /* Allow leading '+' - bb_strtoull() by itself does not allow it,
+ * and probably shouldn't (other callers might require purely numeric
+ * inputs to be allowed.
+ */
+ if (arg[0] == '+')
+ arg++;
*(unsigned long long*)result = bb_strtoull(arg, NULL, 0);
/* both coreutils 6.10 and bash 3.2:
* $ printf '%x\n' -2
@@ -107,6 +113,8 @@ static void FAST_FUNC conv_strtoull(const char *arg, void *result)
}
static void FAST_FUNC conv_strtoll(const char *arg, void *result)
{
+ if (arg[0] == '+')
+ arg++;
*(long long*)result = bb_strtoll(arg, NULL, 0);
}
static void FAST_FUNC conv_strtod(const char *arg, void *result)