summaryrefslogtreecommitdiff
path: root/source3
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
commit1078eb21c49d707ddeef2257353f35c10d131b9f (patch)
tree64e7f4ff60069931f905f27a200687099fa030bf /source3
parent058c4f84924c07b88ccaf3d617f3abff797a7cc8 (diff)
downloadsamba-1078eb21c49d707ddeef2257353f35c10d131b9f.tar.gz
samba-1078eb21c49d707ddeef2257353f35c10d131b9f.tar.bz2
samba-1078eb21c49d707ddeef2257353f35c10d131b9f.zip
tdb_delete: 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')
-rw-r--r--source3/lib/gencache.c6
-rw-r--r--source3/libsmb/smb_share_modes.c4
-rw-r--r--source3/winbindd/winbindd_cache.c2
3 files changed, 6 insertions, 6 deletions
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index 5e15472829..5c9c1a296a 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -548,7 +548,7 @@ static int stabilize_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val,
}
if ((timeout < time(NULL)) || (val.dsize == 0)) {
res = tdb_delete(cache, key);
- if ((res == -1) && (tdb_error(cache) == TDB_ERR_NOEXIST)) {
+ if ((res != 0) && (tdb_error(cache) == TDB_ERR_NOEXIST)) {
res = 0;
} else {
state->written = true;
@@ -560,14 +560,14 @@ static int stabilize_fn(struct tdb_context *tdb, TDB_DATA key, TDB_DATA val,
}
}
- if (res == -1) {
+ if (res != 0) {
DEBUG(10, ("Transfer to gencache.tdb failed: %s\n",
tdb_errorstr(cache)));
state->error = true;
return -1;
}
- if (tdb_delete(cache_notrans, key) == -1) {
+ if (tdb_delete(cache_notrans, key) != 0) {
DEBUG(10, ("tdb_delete from gencache_notrans.tdb failed: "
"%s\n", tdb_errorstr(cache_notrans)));
state->error = true;
diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c
index 2bf430dfea..4477da6a19 100644
--- a/source3/libsmb/smb_share_modes.c
+++ b/source3/libsmb/smb_share_modes.c
@@ -450,7 +450,7 @@ int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx,
}
/* It's ours - just remove the entire record. */
free(db_data.dptr);
- return tdb_delete(db_ctx->smb_tdb, locking_key);
+ return tdb_delete(db_ctx->smb_tdb, locking_key) ? -1 : 0;
}
/* More than one - allocate a new record minus the one we'll delete. */
@@ -489,7 +489,7 @@ int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx,
/* None left after pruning. Delete record. */
free(db_data.dptr);
free(new_data_p);
- return tdb_delete(db_ctx->smb_tdb, locking_key);
+ return tdb_delete(db_ctx->smb_tdb, locking_key) ? -1 : 0;
}
/* Copy any delete tokens plus the terminating filenames. */
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index daea4e866a..c45aabc902 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -4420,7 +4420,7 @@ static bool wcache_tdc_store_list( struct winbindd_tdc_domain *domains, size_t n
SAFE_FREE( data.dptr );
SAFE_FREE( key.dptr );
- return ( ret != -1 );
+ return ( ret == 0 );
}
/*********************************************************************