summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2011-06-20 18:40:31 +0930
committerRusty Russell <rusty@rustcorp.com.au>2011-06-20 11:18:35 +0200
commit868d77bc5b38e628f74d5cd03c5f87eb5a666b09 (patch)
treeb27c09c9407fb2f90dbd2d0ecee63320dcaff497 /source3/lib
parentd6251996fa5b8371c0f7449825b5d1788da95dd0 (diff)
downloadsamba-868d77bc5b38e628f74d5cd03c5f87eb5a666b09.tar.gz
samba-868d77bc5b38e628f74d5cd03c5f87eb5a666b09.tar.bz2
samba-868d77bc5b38e628f74d5cd03c5f87eb5a666b09.zip
tdb_chainlock: check returns for 0, not -1.
TDB2 returns a negative error number on failure. This is compatible if we always check for != 0 instead of == -1. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/messages_local.c4
-rw-r--r--source3/lib/util_tdb.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c
index d7f370c9e4..455f3d3476 100644
--- a/source3/lib/messages_local.c
+++ b/source3/lib/messages_local.c
@@ -352,7 +352,7 @@ static NTSTATUS messaging_tdb_send(struct messaging_context *msg_ctx,
key = message_key_pid(frame, pid);
- if (tdb_chainlock(tdb->tdb, key) == -1) {
+ if (tdb_chainlock(tdb->tdb, key) != 0) {
TALLOC_FREE(frame);
return NT_STATUS_LOCK_NOT_GRANTED;
}
@@ -420,7 +420,7 @@ static NTSTATUS retrieve_all_messages(TDB_CONTEXT *msg_tdb,
TDB_DATA key = message_key_pid(mem_ctx, id);
NTSTATUS status;
- if (tdb_chainlock(msg_tdb, key) == -1) {
+ if (tdb_chainlock(msg_tdb, key) != 0) {
TALLOC_FREE(key.dptr);
return NT_STATUS_LOCK_NOT_GRANTED;
}
diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c
index f0fc8cd29b..e78dbec704 100644
--- a/source3/lib/util_tdb.c
+++ b/source3/lib/util_tdb.c
@@ -78,7 +78,7 @@ static int tdb_chainlock_with_timeout_internal( TDB_CONTEXT *tdb, TDB_DATA key,
}
}
- return ret;
+ return ret == 0 ? 0 : -1;
}
/****************************************************************************