util_tdb: return -1/0 from lock_with_timeout functions.
authorRusty Russell <rusty@rustcorp.com.au>
Tue, 13 Sep 2011 22:43:28 +0000 (08:13 +0930)
committerRusty Russell <rusty@rustcorp.com.au>
Tue, 13 Sep 2011 22:43:28 +0000 (08:13 +0930)
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>
source3/lib/util_tdb.c

index 1ba5ed4120cc384189deb878187f5c35ff1007c0..aea5c746509be19eba5bf6b73a84c8145080a85c 100644 (file)
@@ -102,7 +102,7 @@ static int tdb_chainlock_with_timeout_internal(struct tdb_context *tdb,
                locking.base.attr = TDB_ATTRIBUTE_FLOCK;
                ecode = tdb_get_attribute(tdb, &locking);
                if (ecode != TDB_SUCCESS)
-                       return ecode;
+                       return -1;
 
                /* Replace locking function with our own. */
                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);
                if (ecode != TDB_SUCCESS)
-                       return ecode;
+                       return -1;
        }
        if (rw_type == F_RDLCK)
                ecode = tdb_chainlock_read(tdb, key);