From: Rusty Russell Date: Wed, 31 Aug 2011 01:10:12 +0000 (+0930) Subject: tdb2: Fix to always use 64-bit offset definition X-Git-Url: https://git.ozlabs.org/?p=ccan;a=commitdiff_plain;h=baa17ee2d5e01a32030f19e566007417d72b4b6e;ds=sidebyside tdb2: Fix to always use 64-bit offset definition We use off_t in the tdb2 interface (for tdb_attribute_flock); we need to make sure that all callers agree on the size. This also causes a problem in the tests: it's not enough to include config.h first, we need the _FILE_OFFSET_BITS define from private.h. Otherwise, we can disagree about the definitions of F_SETLK, F_SETLKW and off_t, causing strange problems. --- diff --git a/ccan/tdb2/private.h b/ccan/tdb2/private.h index 1650cf83..6a742496 100644 --- a/ccan/tdb2/private.h +++ b/ccan/tdb2/private.h @@ -18,26 +18,18 @@ License along with this library; if not, see . */ -#include "config.h" -#if HAVE_FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 64 -#endif -#include -#include +#include #include #include #include #include #include #include -#include #include #include #include #include -#include #include -#include #include #ifndef TEST_IT diff --git a/ccan/tdb2/tdb2.h b/ccan/tdb2/tdb2.h index 2b9f4621..01413f20 100644 --- a/ccan/tdb2/tdb2.h +++ b/ccan/tdb2/tdb2.h @@ -30,6 +30,10 @@ extern "C" { #endif #ifndef _SAMBA_BUILD_ +#include "config.h" +#if HAVE_FILE_OFFSET_BITS +#define _FILE_OFFSET_BITS 64 +#endif /* For mode_t */ #include /* For O_* flags. */ diff --git a/ccan/tdb2/test/lock-tracking.c b/ccan/tdb2/test/lock-tracking.c index 05dba32f..ba093992 100644 --- a/ccan/tdb2/test/lock-tracking.c +++ b/ccan/tdb2/test/lock-tracking.c @@ -1,10 +1,10 @@ /* We save the locks so we can reaquire them. */ +#include #include #include #include #include #include -#include #include "lock-tracking.h" struct lock { diff --git a/ccan/tdb2/test/run-56-open-during-transaction.c b/ccan/tdb2/test/run-56-open-during-transaction.c index 96107d63..88933e02 100644 --- a/ccan/tdb2/test/run-56-open-during-transaction.c +++ b/ccan/tdb2/test/run-56-open-during-transaction.c @@ -1,4 +1,4 @@ -#include "config.h" +#include #include #include "lock-tracking.h" diff --git a/ccan/tdb2/test/run-57-die-during-transaction.c b/ccan/tdb2/test/run-57-die-during-transaction.c index 84f01eb2..1b028023 100644 --- a/ccan/tdb2/test/run-57-die-during-transaction.c +++ b/ccan/tdb2/test/run-57-die-during-transaction.c @@ -1,4 +1,4 @@ -#include "config.h" +#include #include #include "lock-tracking.h" #include diff --git a/ccan/tdb2/test/run-lockall.c b/ccan/tdb2/test/run-lockall.c index 4aedf597..7f75159c 100644 --- a/ccan/tdb2/test/run-lockall.c +++ b/ccan/tdb2/test/run-lockall.c @@ -1,4 +1,4 @@ -#include "config.h" +#include #include #include "lock-tracking.h"