diff options
| -rw-r--r-- | lib/util/util_tdb.c | 8 | ||||
| -rw-r--r-- | lib/util/util_tdb.h | 4 | ||||
| -rw-r--r-- | source3/lib/dbwrap_tdb.c | 4 | ||||
| -rw-r--r-- | source3/lib/dbwrap_util.c | 2 | ||||
| -rw-r--r-- | source3/lib/eventlog/eventlog.c | 2 | ||||
| -rw-r--r-- | source3/lib/server_mutex.c | 2 | ||||
| -rw-r--r-- | source3/lib/serverid.c | 2 | ||||
| -rw-r--r-- | source3/lib/tdb_validate.c | 2 | ||||
| -rw-r--r-- | source3/lib/util.c | 2 | ||||
| -rw-r--r-- | source3/lib/util_tdb.c | 6 | ||||
| -rw-r--r-- | source3/locking/brlock.c | 2 | ||||
| -rw-r--r-- | source3/locking/locking.c | 2 | ||||
| -rw-r--r-- | source3/modules/nfs4_acls.c | 2 | ||||
| -rw-r--r-- | source3/modules/vfs_acl_tdb.c | 2 | ||||
| -rw-r--r-- | source3/modules/vfs_xattr_tdb.c | 2 | ||||
| -rw-r--r-- | source3/passdb/login_cache.c | 4 | ||||
| -rw-r--r-- | source3/printing/notify.c | 2 | ||||
| -rw-r--r-- | source3/printing/printing.c | 14 | ||||
| -rw-r--r-- | source3/smbd/notify_internal.c | 2 | ||||
| -rw-r--r-- | source3/torture/torture.c | 8 | ||||
| -rw-r--r-- | source3/utils/net_idmap_check.c | 4 | ||||
| -rw-r--r-- | source3/winbindd/winbindd_cache.c | 2 | 
22 files changed, 40 insertions, 40 deletions
diff --git a/lib/util/util_tdb.c b/lib/util/util_tdb.c index 304239f951..02c7095f66 100644 --- a/lib/util/util_tdb.c +++ b/lib/util/util_tdb.c @@ -57,7 +57,7 @@ TDB_DATA string_term_tdb_data(const char *string)  }  /**************************************************************************** - Lock a chain by string. Return -1 if lock failed. + Lock a chain by string. Return non-zero if lock failed.  ****************************************************************************/  int tdb_lock_bystring(struct tdb_context *tdb, const char *keyval) @@ -79,7 +79,7 @@ void tdb_unlock_bystring(struct tdb_context *tdb, const char *keyval)  }  /**************************************************************************** - Read lock a chain by string. Return -1 if lock failed. + Read lock a chain by string. Return non-zero if lock failed.  ****************************************************************************/  int tdb_read_lock_bystring(struct tdb_context *tdb, const char *keyval) @@ -263,7 +263,7 @@ int32_t tdb_change_int32_atomic(struct tdb_context *tdb, const char *keystr, int  	int32_t val;  	int32_t ret = -1; -	if (tdb_lock_bystring(tdb, keystr) == -1) +	if (tdb_lock_bystring(tdb, keystr) != 0)  		return -1;  	if ((val = tdb_fetch_int32(tdb, keystr)) == -1) { @@ -304,7 +304,7 @@ bool tdb_change_uint32_atomic(struct tdb_context *tdb, const char *keystr, uint3  	uint32_t val;  	bool ret = false; -	if (tdb_lock_bystring(tdb, keystr) == -1) +	if (tdb_lock_bystring(tdb, keystr) != 0)  		return false;  	if (!tdb_fetch_uint32(tdb, keystr, &val)) { diff --git a/lib/util/util_tdb.h b/lib/util/util_tdb.h index edffa058d7..2d805d7d20 100644 --- a/lib/util/util_tdb.h +++ b/lib/util/util_tdb.h @@ -31,7 +31,7 @@ TDB_DATA string_tdb_data(const char *string);  TDB_DATA string_term_tdb_data(const char *string);  /**************************************************************************** - Lock a chain by string. Return -1 if lock failed. + Lock a chain by string. Return non-zero if lock failed.  ****************************************************************************/  int tdb_lock_bystring(struct tdb_context *tdb, const char *keyval); @@ -41,7 +41,7 @@ int tdb_lock_bystring(struct tdb_context *tdb, const char *keyval);  void tdb_unlock_bystring(struct tdb_context *tdb, const char *keyval);  /**************************************************************************** - Read lock a chain by string. Return -1 if lock failed. + Read lock a chain by string. Return non-zero if lock failed.  ****************************************************************************/  int tdb_read_lock_bystring(struct tdb_context *tdb, const char *keyval); diff --git a/source3/lib/dbwrap_tdb.c b/source3/lib/dbwrap_tdb.c index 2b5f58a56d..2efb3dfe39 100644 --- a/source3/lib/dbwrap_tdb.c +++ b/source3/lib/dbwrap_tdb.c @@ -183,7 +183,7 @@ static int db_tdb_parse(struct db_context *db, TDB_DATA key,  	struct db_tdb_ctx *ctx = talloc_get_type_abort(  		db->private_data, struct db_tdb_ctx); -	return tdb_parse_record(ctx->wtdb->tdb, key, parser, private_data) ? -1 : 0; +	return tdb_parse_record(ctx->wtdb->tdb, key, parser, private_data);  }  static NTSTATUS db_tdb_store(struct db_record *rec, TDB_DATA data, int flag) @@ -320,7 +320,7 @@ static int db_tdb_transaction_commit(struct db_context *db)  {  	struct db_tdb_ctx *db_ctx =  		talloc_get_type_abort(db->private_data, struct db_tdb_ctx); -	return tdb_transaction_commit(db_ctx->wtdb->tdb) == 0 ? 0 : -1; +	return tdb_transaction_commit(db_ctx->wtdb->tdb);  }  static int db_tdb_transaction_cancel(struct db_context *db) diff --git a/source3/lib/dbwrap_util.c b/source3/lib/dbwrap_util.c index 44a1b8827b..effcf40c6b 100644 --- a/source3/lib/dbwrap_util.c +++ b/source3/lib/dbwrap_util.c @@ -492,7 +492,7 @@ TDB_DATA dbwrap_fetch(struct db_context *db, TALLOC_CTX *mem_ctx,  {  	TDB_DATA result; -	if (db->fetch(db, mem_ctx, key, &result) == -1) { +	if (db->fetch(db, mem_ctx, key, &result) != 0) {  		return make_tdb_data(NULL, 0);  	} diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c index c29c6f0ed4..67583b8666 100644 --- a/source3/lib/eventlog/eventlog.c +++ b/source3/lib/eventlog/eventlog.c @@ -781,7 +781,7 @@ NTSTATUS evlog_push_record_tdb(TALLOC_CTX *mem_ctx,  	/* lock */  	ret = tdb_lock_bystring_with_timeout(tdb, EVT_NEXT_RECORD, 1); -	if (ret == -1) { +	if (ret != 0) {  		return NT_STATUS_LOCK_NOT_GRANTED;  	} diff --git a/source3/lib/server_mutex.c b/source3/lib/server_mutex.c index 6eac3182be..dc65819197 100644 --- a/source3/lib/server_mutex.c +++ b/source3/lib/server_mutex.c @@ -70,7 +70,7 @@ struct named_mutex *grab_named_mutex(TALLOC_CTX *mem_ctx, const char *name,  	}  	if (tdb_lock_bystring_with_timeout(result->tdb->tdb, name, -					   timeout) == -1) { +					   timeout) != 0) {  		DEBUG(1, ("Could not get the lock for %s\n", name));  		TALLOC_FREE(result);  		return NULL; diff --git a/source3/lib/serverid.c b/source3/lib/serverid.c index e63818e1b8..1a1141265a 100644 --- a/source3/lib/serverid.c +++ b/source3/lib/serverid.c @@ -250,7 +250,7 @@ bool serverid_exists(const struct server_id *id)  	state.id = id;  	state.exists = false; -	if (db->parse_record(db, tdbkey, server_exists_parse, &state) == -1) { +	if (db->parse_record(db, tdbkey, server_exists_parse, &state) != 0) {  		return false;  	}  	return state.exists; diff --git a/source3/lib/tdb_validate.c b/source3/lib/tdb_validate.c index 617160ee86..385f4d0ef8 100644 --- a/source3/lib/tdb_validate.c +++ b/source3/lib/tdb_validate.c @@ -51,7 +51,7 @@ static int tdb_validate_child(struct tdb_context *tdb,  	 * but I don't want to change all the callers...  	 */  	ret = tdb_check(tdb, NULL, NULL); -	if (ret == -1) { +	if (ret != 0) {  		v_status.tdb_error = True;  		v_status.success = False;  		goto out; diff --git a/source3/lib/util.c b/source3/lib/util.c index b25c15c7a3..b8fc319a6f 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -406,7 +406,7 @@ NTSTATUS reinit_after_fork(struct messaging_context *msg_ctx,  	set_need_random_reseed();  	/* tdb needs special fork handling */ -	if (tdb_reopen_all(parent_longlived ? 1 : 0) == -1) { +	if (tdb_reopen_all(parent_longlived ? 1 : 0) != 0) {  		DEBUG(0,("tdb_reopen_all failed.\n"));  		status = NT_STATUS_OPEN_FAILED;  		goto done; diff --git a/source3/lib/util_tdb.c b/source3/lib/util_tdb.c index 2d49b9e2ec..4756fd84ef 100644 --- a/source3/lib/util_tdb.c +++ b/source3/lib/util_tdb.c @@ -67,7 +67,7 @@ static int tdb_chainlock_with_timeout_internal( TDB_CONTEXT *tdb, TDB_DATA key,  		alarm(0);  		tdb_setalarm_sigptr(tdb, NULL);  		CatchSignal(SIGALRM, SIG_IGN); -		if (gotalarm && (ret == -1)) { +		if (gotalarm && (ret != 0)) {  			DEBUG(0,("tdb_chainlock_with_timeout_internal: alarm (%u) timed out for key %s in tdb %s\n",  				timeout, key.dptr, tdb_name(tdb)));  			/* TODO: If we time out waiting for a lock, it might @@ -82,7 +82,7 @@ static int tdb_chainlock_with_timeout_internal( TDB_CONTEXT *tdb, TDB_DATA key,  }  /**************************************************************************** - Write lock a chain. Return -1 if timeout or lock failed. + Write lock a chain. Return non-zero if timeout or lock failed.  ****************************************************************************/  int tdb_chainlock_with_timeout( TDB_CONTEXT *tdb, TDB_DATA key, unsigned int timeout) @@ -99,7 +99,7 @@ int tdb_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval,  }  /**************************************************************************** - Read lock a chain by string. Return -1 if timeout or lock failed. + Read lock a chain by string. Return non-zero if timeout or lock failed.  ****************************************************************************/  int tdb_read_lock_bystring_with_timeout(TDB_CONTEXT *tdb, const char *keyval, unsigned int timeout) diff --git a/source3/locking/brlock.c b/source3/locking/brlock.c index ad0f9d5e52..6eef695f69 100644 --- a/source3/locking/brlock.c +++ b/source3/locking/brlock.c @@ -1845,7 +1845,7 @@ static struct byte_range_lock *brl_get_locks_internal(TALLOC_CTX *mem_ctx,  	}  	if (do_read_only) { -		if (brlock_db->fetch(brlock_db, br_lck, key, &data) == -1) { +		if (brlock_db->fetch(brlock_db, br_lck, key, &data) != 0) {  			DEBUG(3, ("Could not fetch byte range lock record\n"));  			TALLOC_FREE(br_lck);  			return NULL; diff --git a/source3/locking/locking.c b/source3/locking/locking.c index e0a3b93ce7..81e93a555a 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -1009,7 +1009,7 @@ struct share_mode_lock *fetch_share_mode_unlocked(TALLOC_CTX *mem_ctx,  		return NULL;  	} -	if (lock_db->fetch(lock_db, lck, key, &data) == -1) { +	if (lock_db->fetch(lock_db, lck, key, &data) != 0) {  		DEBUG(3, ("Could not fetch share entry\n"));  		TALLOC_FREE(lck);  		return NULL; diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c index bbde53236b..dbfa36e6c2 100644 --- a/source3/modules/nfs4_acls.c +++ b/source3/modules/nfs4_acls.c @@ -574,7 +574,7 @@ static bool nfs4_map_sid(smbacl4_vfs_params *params, const struct dom_sid *src,  	if (mapping_db->fetch(mapping_db, NULL,  			      string_term_tdb_data(sid_string_tos(src)), -			      &data) == -1) { +			      &data) != 0) {  		DEBUG(10, ("could not find mapping for SID %s\n",  			   sid_string_dbg(src)));  		return False; diff --git a/source3/modules/vfs_acl_tdb.c b/source3/modules/vfs_acl_tdb.c index 1e3313120c..0b03896dd9 100644 --- a/source3/modules/vfs_acl_tdb.c +++ b/source3/modules/vfs_acl_tdb.c @@ -177,7 +177,7 @@ static NTSTATUS get_acl_blob(TALLOC_CTX *ctx,  	if (db->fetch(db,  			ctx,  			make_tdb_data(id_buf, sizeof(id_buf)), -			&data) == -1) { +			&data) != 0) {  		return NT_STATUS_INTERNAL_DB_CORRUPTION;  	} diff --git a/source3/modules/vfs_xattr_tdb.c b/source3/modules/vfs_xattr_tdb.c index 200450b131..40ccf06dd9 100644 --- a/source3/modules/vfs_xattr_tdb.c +++ b/source3/modules/vfs_xattr_tdb.c @@ -108,7 +108,7 @@ static NTSTATUS xattr_tdb_load_attrs(TALLOC_CTX *mem_ctx,  	if (db_ctx->fetch(db_ctx, mem_ctx,  			  make_tdb_data(id_buf, sizeof(id_buf)), -			  &data) == -1) { +			  &data) != 0) {  		return NT_STATUS_INTERNAL_DB_CORRUPTION;  	} diff --git a/source3/passdb/login_cache.c b/source3/passdb/login_cache.c index 629f8a7d5e..a53fe5b24f 100644 --- a/source3/passdb/login_cache.c +++ b/source3/passdb/login_cache.c @@ -59,10 +59,10 @@ bool login_cache_init(void)  bool login_cache_shutdown(void)  { -	/* tdb_close routine returns -1 on error */ +	/* tdb_close routine returns non-zero on error */  	if (!cache) return False;  	DEBUG(5, ("Closing cache file\n")); -	return tdb_close(cache) != -1; +	return tdb_close(cache) == 0;  }  /* if we can't read the cache, oh well, no need to return anything */ diff --git a/source3/printing/notify.c b/source3/printing/notify.c index 0295ad2f1f..b6b7ea045e 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -632,7 +632,7 @@ static bool print_notify_pid_list(const char *printername, TALLOC_CTX *mem_ctx,  		return False;  	tdb = pdb->tdb; -	if (tdb_read_lock_bystring_with_timeout(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { +	if (tdb_read_lock_bystring_with_timeout(tdb, NOTIFY_PID_LIST_KEY, 10) != 0) {  		DEBUG(0,("print_notify_pid_list: Failed to lock printer %s database\n",  					printername));  		if (pdb) diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 6503407f82..0c070c7668 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -208,7 +208,7 @@ bool print_backend_init(struct messaging_context *msg_ctx)  		pdb = get_print_db_byname(lp_const_servicename(snum));  		if (!pdb)  			continue; -		if (tdb_lock_bystring(pdb->tdb, sversion) == -1) { +		if (tdb_lock_bystring(pdb->tdb, sversion) != 0) {  			DEBUG(0,("print_backend_init: Failed to open printer %s database\n", lp_const_servicename(snum) ));  			release_print_db(pdb);  			return False; @@ -1516,7 +1516,7 @@ static void print_queue_update_with_lock( struct tevent_context *ev,  	slprintf(keystr, sizeof(keystr) - 1, "LOCK/%s", sharename);  	/* Only wait 10 seconds for this. */ -	if (tdb_lock_bystring_with_timeout(pdb->tdb, keystr, 10) == -1) { +	if (tdb_lock_bystring_with_timeout(pdb->tdb, keystr, 10) != 0) {  		DEBUG(0,("print_queue_update_with_lock: Failed to lock printer %s database\n", sharename));  		release_print_db(pdb);  		return; @@ -1885,7 +1885,7 @@ bool print_notify_register_pid(int snum)  		tdb = pdb->tdb;  	} -	if (tdb_lock_bystring_with_timeout(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { +	if (tdb_lock_bystring_with_timeout(tdb, NOTIFY_PID_LIST_KEY, 10) != 0) {  		DEBUG(0,("print_notify_register_pid: Failed to lock printer %s\n",  					printername));  		if (pdb) @@ -1975,7 +1975,7 @@ bool print_notify_deregister_pid(int snum)  		tdb = pdb->tdb;  	} -	if (tdb_lock_bystring_with_timeout(tdb, NOTIFY_PID_LIST_KEY, 10) == -1) { +	if (tdb_lock_bystring_with_timeout(tdb, NOTIFY_PID_LIST_KEY, 10) != 0) {  		DEBUG(0,("print_notify_register_pid: Failed to lock \  printer %s database\n", printername));  		if (pdb) @@ -2134,7 +2134,7 @@ static bool remove_from_jobs_added(const char* sharename, uint32 jobid)  	key = string_tdb_data("INFO/jobs_added"); -	if (tdb_chainlock_with_timeout(pdb->tdb, key, 5) == -1) +	if (tdb_chainlock_with_timeout(pdb->tdb, key, 5) != 0)  		goto out;  	gotlock = True; @@ -2561,7 +2561,7 @@ static WERROR allocate_print_jobid(struct tdb_print_db *pdb, int snum,  		/* Lock the database - only wait 20 seconds. */  		ret = tdb_lock_bystring_with_timeout(pdb->tdb,  						     "INFO/nextjob", 20); -		if (ret == -1) { +		if (ret != 0) {  			DEBUG(0, ("allocate_print_jobid: "  				  "Failed to lock printing database %s\n",  				  sharename)); @@ -2589,7 +2589,7 @@ static WERROR allocate_print_jobid(struct tdb_print_db *pdb, int snum,  		jobid = NEXT_JOBID(jobid);  		ret = tdb_store_int32(pdb->tdb, "INFO/nextjob", jobid); -		if (ret == -1) { +		if (ret != 0) {  			terr = tdb_error(pdb->tdb);  			DEBUG(3, ("allocate_print_jobid: "  				  "Failed to store INFO/nextjob.\n")); diff --git a/source3/smbd/notify_internal.c b/source3/smbd/notify_internal.c index 3aea1625eb..a0193a4467 100644 --- a/source3/smbd/notify_internal.c +++ b/source3/smbd/notify_internal.c @@ -843,7 +843,7 @@ void notify_onelevel(struct notify_context *notify, uint32_t action,  	if (notify->db_onelevel->fetch(  		    notify->db_onelevel, array,  		    make_tdb_data((uint8_t *)&fid, sizeof(fid)), -		    &dbuf) == -1) { +		    &dbuf) != 0) {  		TALLOC_FREE(array);  		return;  	} diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 0731326cf9..faa4326489 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -8348,7 +8348,7 @@ static bool run_local_dbtrans(int dummy)  	}  	res = db->transaction_start(db); -	if (res == -1) { +	if (res != 0) {  		printf(__location__ "transaction_start failed\n");  		return false;  	} @@ -8375,7 +8375,7 @@ static bool run_local_dbtrans(int dummy)  	TALLOC_FREE(rec);  	res = db->transaction_commit(db); -	if (res == -1) { +	if (res != 0) {  		printf(__location__ "transaction_commit failed\n");  		return false;  	} @@ -8385,7 +8385,7 @@ static bool run_local_dbtrans(int dummy)  		int i;  		res = db->transaction_start(db); -		if (res == -1) { +		if (res != 0) {  			printf(__location__ "transaction_start failed\n");  			break;  		} @@ -8415,7 +8415,7 @@ static bool run_local_dbtrans(int dummy)  		printf("val2=%d\r", val2);  		res = db->transaction_commit(db); -		if (res == -1) { +		if (res != 0) {  			printf(__location__ "transaction_commit failed\n");  			break;  		} diff --git a/source3/utils/net_idmap_check.c b/source3/utils/net_idmap_check.c index e406a65679..3adc060a7c 100644 --- a/source3/utils/net_idmap_check.c +++ b/source3/utils/net_idmap_check.c @@ -346,7 +346,7 @@ fetch_record(struct check_ctx* ctx, TALLOC_CTX* mem_ctx, TDB_DATA key)  {  	TDB_DATA tmp; -	if (ctx->diff->fetch(ctx->diff, mem_ctx, key, &tmp) == -1) { +	if (ctx->diff->fetch(ctx->diff, mem_ctx, key, &tmp) != 0) {  		DEBUG(0, ("Out of memory!\n"));  		return tdb_null;  	} @@ -357,7 +357,7 @@ fetch_record(struct check_ctx* ctx, TALLOC_CTX* mem_ctx, TDB_DATA key)  		return ret;  	} -	if (ctx->db->fetch(ctx->db, mem_ctx, key, &tmp) == -1) { +	if (ctx->db->fetch(ctx->db, mem_ctx, key, &tmp) != 0) {  		DEBUG(0, ("Out of memory!\n"));  		return tdb_null;  	} diff --git a/source3/winbindd/winbindd_cache.c b/source3/winbindd/winbindd_cache.c index 50218d0132..58a8e710f6 100644 --- a/source3/winbindd/winbindd_cache.c +++ b/source3/winbindd/winbindd_cache.c @@ -484,7 +484,7 @@ bool wcache_store_seqnum(const char *domain_name, uint32_t seqnum,  	ret = tdb_store_bystring(wcache->tdb, key_str,  				 make_tdb_data(buf, sizeof(buf)), TDB_REPLACE);  	TALLOC_FREE(key_str); -	if (ret == -1) { +	if (ret != 0) {  		DEBUG(10, ("tdb_store_bystring failed: %s\n",  			   tdb_errorstr_compat(wcache->tdb)));  		TALLOC_FREE(key_str);  | 
