lib/replace: Replace BSD strtoull by wrapping strtoull instead of strtouq
authorFelix Janda <felix.janda@posteo.de>
Thu, 22 Oct 2015 10:32:48 +0000 (12:32 +0200)
committerStefan Metzmacher <metze@samba.org>
Sat, 31 Oct 2015 21:03:14 +0000 (22:03 +0100)
Same as commit e50bf6d537ef09e936d19d6e0bf63f9bbc5d4818 but for strtoull
instead of strtoll.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=11455

Signed-off-by: Felix Janda <felix.janda@posteo.de>
Reviewed-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
lib/replace/replace.c

index c9c12a4ac9af3da5abd3a9e5c6b45411916d850f..ce8f38a6e73e9b9dfec172520ce37b4b2c4d90d5 100644 (file)
@@ -573,11 +573,11 @@ unsigned long long int rep_strtoull(const char *str, char **endptr, int base)
 }
 #else
 #ifdef HAVE_BSD_STRTOLL
-#ifdef HAVE_STRTOUQ
+#undef strtoull
 unsigned long long int rep_strtoull(const char *str, char **endptr, int base)
 {
-       unsigned long long int nb = strtouq(str, endptr, base);
-       /* In linux EINVAL is only returned if base is not ok */
+       unsigned long long int nb = strtoull(str, endptr, base);
+       /* With glibc EINVAL is only returned if base is not ok */
        if (errno == EINVAL) {
                if (base == 0 || (base >1 && base <37)) {
                        /* Base was ok so it's because we were not
@@ -589,9 +589,6 @@ unsigned long long int rep_strtoull(const char *str, char **endptr, int base)
        }
        return nb;
 }
-#else
-#error "You need the strtouq function"
-#endif /* HAVE_STRTOUQ */
 #endif /* HAVE_BSD_STRTOLL */
 #endif /* HAVE_STRTOULL */