aboutsummaryrefslogtreecommitdiff
path: root/coreutils/printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'coreutils/printf.c')
-rw-r--r--coreutils/printf.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/coreutils/printf.c b/coreutils/printf.c
index 0b004eaeb..2beea7189 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -78,6 +78,14 @@ static int multiconvert(const char *arg, void *result, converter convert)
static void FAST_FUNC conv_strtoull(const char *arg, void *result)
{
*(unsigned long long*)result = bb_strtoull(arg, NULL, 0);
+ /* both coreutils 6.10 and bash 3.2:
+ * $ printf '%x\n' -2
+ * fffffffffffffffe
+ * Mimic that:
+ */
+ if (errno) {
+ *(unsigned long long*)result = bb_strtoll(arg, NULL, 0);
+ }
}
static void FAST_FUNC conv_strtoll(const char *arg, void *result)
{