summaryrefslogtreecommitdiffstats
path: root/lib/strutils.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/strutils.c')
-rw-r--r--lib/strutils.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/strutils.c b/lib/strutils.c
index 369d50159..327bf37bc 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -122,13 +122,18 @@ check_suffix:
for (p = fstr; *p == '0'; p++)
frac_zeros++;
- errno = 0, end = NULL;
- frac = strtoumax(fstr, &end, 0);
- if (end == fstr ||
- (errno != 0 && (frac == UINTMAX_MAX || frac == 0))) {
- rc = errno ? -errno : -EINVAL;
- goto err;
- }
+ fstr = p;
+ if (isdigit(*fstr)) {
+ errno = 0, end = NULL;
+ frac = strtoumax(fstr, &end, 0);
+ if (end == fstr ||
+ (errno != 0 && (frac == UINTMAX_MAX || frac == 0))) {
+ rc = errno ? -errno : -EINVAL;
+ goto err;
+ }
+ } else
+ end = (char *) p;
+
if (frac && (!end || !*end)) {
rc = -EINVAL;
goto err; /* without suffix, but with frac */