Commit baa17ee2 authored by Rusty Russell's avatar Rusty Russell

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.
parent 0eb02957
......@@ -18,26 +18,18 @@
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#if HAVE_FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
#include <stdint.h>
#include <stdbool.h>
#include <ccan/tdb2/tdb2.h>
#include <stdlib.h>
#include <stddef.h>
#include <sys/time.h>
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <stdio.h>
#include <utime.h>
#include <unistd.h>
#include <ccan/tdb2/tdb2.h>
#include <ccan/likely/likely.h>
#include <ccan/compiler/compiler.h>
#include <ccan/endian/endian.h>
#ifndef TEST_IT
......
......@@ -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 <sys/types.h>
/* For O_* flags. */
......
/* We save the locks so we can reaquire them. */
#include <ccan/tdb2/private.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <stdlib.h>
#include <ccan/tap/tap.h>
#include <ccan/tdb2/private.h>
#include "lock-tracking.h"
struct lock {
......
#include "config.h"
#include <ccan/tdb2/private.h>
#include <unistd.h>
#include "lock-tracking.h"
......
#include "config.h"
#include <ccan/tdb2/private.h>
#include <unistd.h>
#include "lock-tracking.h"
#include <ccan/tap/tap.h>
......
#include "config.h"
#include <ccan/tdb2/private.h>
#include <unistd.h>
#include "lock-tracking.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment