diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2021-10-08 15:50:36 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2021-10-08 15:54:40 +0200 |
commit | 049775b2ef39a20dc08a6bf89e2831e8422f7363 (patch) | |
tree | 48e5447ceddbbe62a79bec4814deccdaa1945f93 /include/libbb.h | |
parent | 84874785c2e226002bb05a42c704ed2d18b99508 (diff) |
libbb.h: fix logic selecting incorrect BB_STRTOOFF for !LFS configs
BB_STRTOOFF() was equal to bb_strtou(). On x86_64, it's incorrect.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include/libbb.h')
-rw-r--r-- | include/libbb.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/include/libbb.h b/include/libbb.h index 02cc008f0..b72576f28 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -305,9 +305,13 @@ typedef unsigned long long uoff_t; # endif #else /* CONFIG_LFS is off */ -# if UINT_MAX == 0xffffffff -/* While sizeof(off_t) == sizeof(int), off_t is typedef'ed to long anyway. - * gcc will throw warnings on printf("%d", off_t). Crap... */ +/* sizeof(off_t) == sizeof(long). + * May or may not be == sizeof(int). If it is, use xatoi_positive() + * and bb_strtou() instead of xatoul_range() and bb_strtoul(). + * Even if sizeof(off_t) == sizeof(int), off_t is typedef'ed to long anyway. + * gcc will throw warnings on printf("%d", off_t)... Have to use %ld etc. + */ +# if UINT_MAX == ULONG_MAX typedef unsigned long uoff_t; # define XATOOFF(a) xatoi_positive(a) # define BB_STRTOOFF bb_strtou |