diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-04-19 12:06:05 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-04-19 12:06:05 +0930 |
commit | 7deeacae2bab03d5e2ea2642f028a4011ce3bec3 (patch) | |
tree | fc251e9d3047c390342a5cff3931fe32b9374830 /source3/libsmb | |
parent | 3ccfe7cb7be80cc6fa5b8fc437af72168515b892 (diff) | |
download | samba-7deeacae2bab03d5e2ea2642f028a4011ce3bec3.tar.gz samba-7deeacae2bab03d5e2ea2642f028a4011ce3bec3.tar.bz2 samba-7deeacae2bab03d5e2ea2642f028a4011ce3bec3.zip |
gencache: don't use CLEAR_IF_FIRST as fallback.
CLEAR_IF_FIRST only works if *all* openers use that flag.
So just truncate the file: it's racy, but that's what we're doing anyway.
We'd really need a TDB_OPENCHECK_OR_CLEAR flag to do this properly (or in
TDB2, a open hook at the right point).
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/samlogon_cache.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c index 590c950a9c..01a5282751 100644 --- a/source3/libsmb/samlogon_cache.c +++ b/source3/libsmb/samlogon_cache.c @@ -71,16 +71,9 @@ clear: } first_try = false; - DEBUG(0,("retry after CLEAR_IF_FIRST for '%s'\n", path)); - tdb = tdb_open_log(path, 0, TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH, - O_RDWR | O_CREAT, 0600); - if (tdb) { - tdb_close(tdb); - goto again; - } - DEBUG(0,("tdb_open_log(%s) with CLEAR_IF_FIRST - failed\n", path)); - - return false; + DEBUG(0,("retry after truncate for '%s'\n", path)); + truncate(path, 0); + goto again; } |