]> git.ozlabs.org Git - ccan/commit
tdb2: fix O_RDONLY opens.
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 20 May 2011 06:23:12 +0000 (15:53 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 20 May 2011 06:23:12 +0000 (15:53 +0930)
commitde868b8eee34e39b4465dd9def9141b97926e847
treed7fbdbe4ba1460b6ba21577aa0e82a21937f606a
parent4601063b15ad7a1896135bf91bbcb7cabfbc9000
tdb2: fix O_RDONLY opens.

We tried to get a F_WRLCK on the open lock; we shouldn't do that for a
read-only tdb.  (TDB1 gets away with it because a read-only open skips
all locking).

We also avoid leaking the fd in two tdb_open() failure paths revealed
by this extra testing.
ccan/tdb2/lock.c
ccan/tdb2/open.c
ccan/tdb2/private.h
ccan/tdb2/test/failtest_helper.h
ccan/tdb2/test/run-05-readonly-open.c [new file with mode: 0644]
ccan/tdb2/transaction.c