From f59a50ee3031c520fdb4183b98fd7b13b94be4f7 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 16 Nov 2011 21:30:19 +0100 Subject: libbb.h: tighten up macro code Signed-off-by: Denys Vlasenko --- include/libbb.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index 09e8d28e7..796351865 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -211,7 +211,7 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN # if ULONG_MAX > 0xffffffff /* "long" is long enough on this system */ typedef unsigned long uoff_t; -# define XATOOFF(a) xatoul_range(a, 0, LONG_MAX) +# define XATOOFF(a) xatoul_range((a), 0, LONG_MAX) /* usage: sz = BB_STRTOOFF(s, NULL, 10); if (errno || sz < 0) die(); */ # define BB_STRTOOFF bb_strtoul # define STRTOOFF strtoul @@ -220,7 +220,7 @@ typedef unsigned long uoff_t; # else /* "long" is too short, need "long long" */ typedef unsigned long long uoff_t; -# define XATOOFF(a) xatoull_range(a, 0, LLONG_MAX) +# define XATOOFF(a) xatoull_range((a), 0, LLONG_MAX) # define BB_STRTOOFF bb_strtoull # define STRTOOFF strtoull # define OFF_FMT "ll" @@ -237,7 +237,7 @@ typedef unsigned long uoff_t; # define OFF_FMT "l" # else typedef unsigned long uoff_t; -# define XATOOFF(a) xatoul_range(a, 0, LONG_MAX) +# define XATOOFF(a) xatoul_range((a), 0, LONG_MAX) # define BB_STRTOOFF bb_strtoul # define STRTOOFF strtol # define OFF_FMT "l" -- cgit v1.2.3 From 1dc80bae0b4c339553b8ee9fd8309c13f8c1f1d8 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 17 Nov 2011 21:51:32 +0100 Subject: libbb.h: add check for bad off_t size detection Signed-off-by: Denys Vlasenko --- include/libbb.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/libbb.h b/include/libbb.h index 796351865..3f6fe47ed 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -245,6 +245,12 @@ typedef unsigned long uoff_t; #endif /* scary. better ideas? (but do *test* them first!) */ #define OFF_T_MAX ((off_t)~((off_t)1 << (sizeof(off_t)*8-1))) +/* Users report bionic to use 32-bit off_t even if LARGEFILE support is requested. + * We misdetected that. Don't let it build: + */ +struct BUG_off_t_size_is_misdetected { + char BUG_off_t_size_is_misdetected[sizeof(off_t) == sizeof(uoff_t) ? 1 : -1]; +}; /* Some useful definitions */ #undef FALSE -- cgit v1.2.3