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
commit5a7874e119acbc80410b2f2c1847371236c22a56 (patch)
tree86a351bdb3abfa3dc78c106f123e508e19a56fe9 /source3
parent9850f256337d70401d962bb1f6d5b834a221358d (diff)
downloadsamba-5a7874e119acbc80410b2f2c1847371236c22a56.tar.gz
samba-5a7874e119acbc80410b2f2c1847371236c22a56.tar.bz2
samba-5a7874e119acbc80410b2f2c1847371236c22a56.zip
tdb_traverse/tdb_traverse_read: check returns for negative, not -1.
TDB2 returns a negative error number on failure. This is compatible if we always check for < 0 instead of == -1. Also, there's no tdb_traverse_read in TDB2: we don't try to make traverse reliable any more, so there are no write locks anyway. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'source3')
-rw-r--r--source3/groupdb/mapping_tdb.c2
-rw-r--r--source3/lib/dbwrap_util.c4
-rw-r--r--source3/lib/gencache.c2
-rw-r--r--source3/lib/tdb_validate.c2
-rw-r--r--source3/printing/nt_printing_tdb.c4
-rw-r--r--source3/registry/reg_backend_db.c2
-rw-r--r--source3/rpc_server/srvsvc/srv_srvsvc_nt.c2
-rw-r--r--source3/smbd/connection.c2
-rw-r--r--source3/smbd/session.c2
-rw-r--r--source3/utils/net_g_lock.c2
-rw-r--r--source3/utils/net_serverid.c4
-rw-r--r--source3/utils/status.c2
-rw-r--r--source3/winbindd/winbindd_cache.c2
13 files changed, 16 insertions, 16 deletions
diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c
index cf8857cda5..fc195cb348 100644
--- a/source3/groupdb/mapping_tdb.c
+++ b/source3/groupdb/mapping_tdb.c
@@ -960,7 +960,7 @@ static bool mapping_switch(const char *ldb_path)
/* ldb is just a very fancy tdb, read out raw data and perform
* conversion */
ret = tdb_traverse(ltdb, convert_ldb_record, NULL);
- if (ret == -1) goto failed;
+ if (ret < 0) goto failed;
if (ltdb) {
tdb_close(ltdb);
diff --git a/source3/lib/dbwrap_util.c b/source3/lib/dbwrap_util.c
index ce5ef52706..44a1b8827b 100644
--- a/source3/lib/dbwrap_util.c
+++ b/source3/lib/dbwrap_util.c
@@ -433,7 +433,7 @@ static NTSTATUS dbwrap_trans_traverse_action(struct db_context* db, void* privat
int ret = db->traverse(db, ctx->f, ctx->private_data);
- return (ret == -1) ? NT_STATUS_INTERNAL_DB_CORRUPTION : NT_STATUS_OK;
+ return (ret < 0) ? NT_STATUS_INTERNAL_DB_CORRUPTION : NT_STATUS_OK;
}
NTSTATUS dbwrap_trans_traverse(struct db_context *db,
@@ -452,7 +452,7 @@ NTSTATUS dbwrap_traverse(struct db_context *db,
void *private_data)
{
int ret = db->traverse(db, f, private_data);
- return (ret == -1) ? NT_STATUS_INTERNAL_DB_CORRUPTION : NT_STATUS_OK;
+ return (ret < 0) ? NT_STATUS_INTERNAL_DB_CORRUPTION : NT_STATUS_OK;
}
diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c
index ab7de21d92..d5ca164943 100644
--- a/source3/lib/gencache.c
+++ b/source3/lib/gencache.c
@@ -488,7 +488,7 @@ bool gencache_stabilize(void)
state.written = false;
res = tdb_traverse(cache_notrans, stabilize_fn, &state);
- if ((res == -1) || state.error) {
+ if ((res < 0) || state.error) {
tdb_transaction_cancel(cache_notrans);
tdb_transaction_cancel(cache);
return false;
diff --git a/source3/lib/tdb_validate.c b/source3/lib/tdb_validate.c
index 7dd7dae5ac..210d91eeb0 100644
--- a/source3/lib/tdb_validate.c
+++ b/source3/lib/tdb_validate.c
@@ -71,7 +71,7 @@ static int tdb_validate_child(struct tdb_context *tdb,
num_entries = tdb_traverse(tdb, validate_fn, (void *)&v_status);
if (!v_status.success) {
goto out;
- } else if (num_entries == -1) {
+ } else if (num_entries < 0) {
v_status.tdb_error = True;
v_status.success = False;
goto out;
diff --git a/source3/printing/nt_printing_tdb.c b/source3/printing/nt_printing_tdb.c
index 8d8d6f7dc7..1361f4b3b3 100644
--- a/source3/printing/nt_printing_tdb.c
+++ b/source3/printing/nt_printing_tdb.c
@@ -266,7 +266,7 @@ static bool upgrade_to_version_4(void)
talloc_destroy( ctx );
- return ( result != -1 );
+ return ( result >= 0 );
}
/*******************************************************************
@@ -334,7 +334,7 @@ static bool upgrade_to_version_5(void)
talloc_destroy( ctx );
- return ( result != -1 );
+ return ( result >= 0 );
}
bool nt_printing_tdb_upgrade(void)
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 05f3a5a0ab..812dd0d43c 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -482,7 +482,7 @@ static WERROR regdb_upgrade_v1_to_v2(void)
talloc_destroy(mem_ctx);
- if (rc == -1) {
+ if (rc < 0) {
return WERR_REG_IO_FAILURE;
}
diff --git a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
index 64a7264ece..2aed300feb 100644
--- a/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
+++ b/source3/rpc_server/srvsvc/srv_srvsvc_nt.c
@@ -136,7 +136,7 @@ static WERROR net_enum_pipes(TALLOC_CTX *ctx,
fenum.username = username;
fenum.ctr3 = *ctr3;
- if (connections_traverse(pipe_enum_fn, &fenum) == -1) {
+ if (connections_traverse(pipe_enum_fn, &fenum) < 0) {
DEBUG(0,("net_enum_pipes: traverse of connections.tdb "
"failed\n"));
return WERR_NOMEM;
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c
index f1ec301ee2..7ed9518756 100644
--- a/source3/smbd/connection.c
+++ b/source3/smbd/connection.c
@@ -120,7 +120,7 @@ int count_current_connections( const char *sharename, bool clear )
ret = connections_forall(count_fn, &cs);
unbecome_root();
- if (ret == -1) {
+ if (ret < 0) {
DEBUG(0,("count_current_connections: traverse of "
"connections.tdb failed\n"));
return 0;
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 12d4818e90..48afb5389f 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -264,7 +264,7 @@ int list_sessions(TALLOC_CTX *mem_ctx, struct sessionid **session_list)
sesslist.sessions = NULL;
ret = sessionid_traverse_read(gather_sessioninfo, (void *) &sesslist);
- if (ret == -1) {
+ if (ret < 0) {
DEBUG(3, ("Session traverse failed\n"));
SAFE_FREE(sesslist.sessions);
*session_list = NULL;
diff --git a/source3/utils/net_g_lock.c b/source3/utils/net_g_lock.c
index bfb9a225ab..f8a7a8b620 100644
--- a/source3/utils/net_g_lock.c
+++ b/source3/utils/net_g_lock.c
@@ -175,7 +175,7 @@ done:
TALLOC_FREE(g_ctx);
TALLOC_FREE(msg);
TALLOC_FREE(ev);
- return ret;
+ return ret < 0 ? -1 : ret;
}
int net_g_lock(struct net_context *c, int argc, const char **argv)
diff --git a/source3/utils/net_serverid.c b/source3/utils/net_serverid.c
index 2c3320f40e..4159eead7a 100644
--- a/source3/utils/net_serverid.c
+++ b/source3/utils/net_serverid.c
@@ -37,7 +37,7 @@ static int net_serverid_list(struct net_context *c, int argc,
const char **argv)
{
d_printf("pid unique_id msg_flags\n");
- return serverid_traverse_read(net_serverid_list_fn, NULL) ? 0 : -1;
+ return serverid_traverse_read(net_serverid_list_fn, NULL) > 0 ? 0 : -1;
}
static int net_serverid_wipe_fn(struct db_record *rec,
@@ -62,7 +62,7 @@ static int net_serverid_wipe_fn(struct db_record *rec,
static int net_serverid_wipe(struct net_context *c, int argc,
const char **argv)
{
- return serverid_traverse(net_serverid_wipe_fn, NULL) ? 0 : -1;
+ return serverid_traverse(net_serverid_wipe_fn, NULL) > 0 ? 0 : -1;
}
static int net_serverid_wipedbs_conn(
diff --git a/source3/utils/status.c b/source3/utils/status.c
index cf625fb73f..4d37f7e66e 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -474,7 +474,7 @@ static int traverse_sessionid(const char *key, struct sessionid *session,
if (result == 0) {
d_printf("No locked files\n");
- } else if (result == -1) {
+ } else if (result < 0) {
d_printf("locked file list truncated\n");
}
diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c
index c45aabc902..b8028b1674 100644
--- a/source3/winbindd/winbindd_cache.c
+++ b/source3/winbindd/winbindd_cache.c
@@ -3383,7 +3383,7 @@ NTSTATUS wcache_remove_oldest_cached_creds(struct winbindd_domain *domain, const
ret = tdb_traverse(cache->tdb, traverse_fn_get_credlist, NULL);
if (ret == 0) {
return NT_STATUS_OK;
- } else if ((ret == -1) || (wcache_cred_list == NULL)) {
+ } else if ((ret < 0) || (wcache_cred_list == NULL)) {
return NT_STATUS_OBJECT_NAME_NOT_FOUND;
}