1
0
mirror of https://github.com/samba-team/samba.git synced 2025-08-02 00:22:11 +03:00

util_tdb: return -1/0 from lock_with_timeout functions.

Keeps the tdb2 API change (which returns error codes, rather than -1)
localized.  The function returns -1 down the other path, so make it
consistent.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2011-09-14 08:13:28 +09:30
parent 5e0f62c3c2
commit 26ce47ecc0

View File

@ -102,7 +102,7 @@ static int tdb_chainlock_with_timeout_internal(struct tdb_context *tdb,
locking.base.attr = TDB_ATTRIBUTE_FLOCK; locking.base.attr = TDB_ATTRIBUTE_FLOCK;
ecode = tdb_get_attribute(tdb, &locking); ecode = tdb_get_attribute(tdb, &locking);
if (ecode != TDB_SUCCESS) if (ecode != TDB_SUCCESS)
return ecode; return -1;
/* Replace locking function with our own. */ /* Replace locking function with our own. */
locking.flock.data = &timeout; locking.flock.data = &timeout;
@ -110,7 +110,7 @@ static int tdb_chainlock_with_timeout_internal(struct tdb_context *tdb,
ecode = tdb_set_attribute(tdb, &locking); ecode = tdb_set_attribute(tdb, &locking);
if (ecode != TDB_SUCCESS) if (ecode != TDB_SUCCESS)
return ecode; return -1;
} }
if (rw_type == F_RDLCK) if (rw_type == F_RDLCK)
ecode = tdb_chainlock_read(tdb, key); ecode = tdb_chainlock_read(tdb, key);