tdb_check fails with tdb read-only open.
tridge at samba.org
tridge at samba.org
Wed Jul 28 16:05:13 MDT 2010
looks good to me - nice and simple :-)
> Modified fix...
>
> ----------------------------------------------------------------------
> >From 04febebb965341342d22f7909d0afb9cf357277e Mon Sep 17 00:00:00 2001
> From: Jeremy Allison <jra at samba.org>
> Date: Wed, 28 Jul 2010 05:15:40 -0700
> Subject: [PATCH] Fix tdb_check() to work with read-only tdb databases.
> The function tdb_lockall() uses F_WRLCK internally, which
> doesn't work on a fd opened with O_RDONLY. Use
> tdb_lockall_read() instead.
>
> Jeremy.
> ---
> lib/tdb/common/check.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/lib/tdb/common/check.c b/lib/tdb/common/check.c
> index 6bbfd7d..2c64043 100644
> --- a/lib/tdb/common/check.c
> +++ b/lib/tdb/common/check.c
> @@ -311,7 +311,7 @@ int tdb_check(struct tdb_context *tdb,
> struct tdb_record rec;
> bool found_recovery = false;
>
> - if (tdb_lockall(tdb) == -1)
> + if (tdb_lockall_read(tdb) == -1)
> return -1;
>
> /* Make sure we know true size of the underlying file. */
> @@ -412,12 +412,12 @@ int tdb_check(struct tdb_context *tdb,
> }
>
> free(hashes);
> - tdb_unlockall(tdb);
> + tdb_unlockall_read(tdb);
> return 0;
>
> free:
> free(hashes);
> unlock:
> - tdb_unlockall(tdb);
> + tdb_unlockall_read(tdb);
> return -1;
> }
> --
> 1.7.0.4
More information about the samba-technical
mailing list