diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2011-06-20 18:40:31 +0930 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2011-06-20 11:18:35 +0200 |
commit | 6bc59d77b64d1ecbe5c906ed2fa80a7b8ca5d420 (patch) | |
tree | 616215df22728c5e4e95cf20f80ff62051274531 /source3 | |
parent | 1078eb21c49d707ddeef2257353f35c10d131b9f (diff) | |
download | samba-6bc59d77b64d1ecbe5c906ed2fa80a7b8ca5d420.tar.gz samba-6bc59d77b64d1ecbe5c906ed2fa80a7b8ca5d420.tar.bz2 samba-6bc59d77b64d1ecbe5c906ed2fa80a7b8ca5d420.zip |
tdb_store: 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/eventlog/eventlog.c | 4 | ||||
-rw-r--r-- | source3/libsmb/samlogon_cache.c | 2 | ||||
-rw-r--r-- | source3/libsmb/smb_share_modes.c | 8 | ||||
-rw-r--r-- | source3/printing/nt_printing_tdb.c | 2 | ||||
-rw-r--r-- | source3/printing/printing.c | 10 |
5 files changed, 13 insertions, 13 deletions
diff --git a/source3/lib/eventlog/eventlog.c b/source3/lib/eventlog/eventlog.c index b719c6f7f8..c29c6f0ed4 100644 --- a/source3/lib/eventlog/eventlog.c +++ b/source3/lib/eventlog/eventlog.c @@ -804,13 +804,13 @@ NTSTATUS evlog_push_record_tdb(TALLOC_CTX *mem_ctx, ebuf.dptr = blob.data; ret = tdb_store(tdb, kbuf, ebuf, 0); - if (ret == -1) { + if (ret != 0) { tdb_unlock_bystring(tdb, EVT_NEXT_RECORD); return NT_STATUS_EVENTLOG_FILE_CORRUPT; } ret = tdb_store_int32(tdb, EVT_NEXT_RECORD, r->record_number + 1); - if (ret == -1) { + if (ret != 0) { tdb_unlock_bystring(tdb, EVT_NEXT_RECORD); return NT_STATUS_EVENTLOG_FILE_CORRUPT; } diff --git a/source3/libsmb/samlogon_cache.c b/source3/libsmb/samlogon_cache.c index 67c0e08114..618a570c4e 100644 --- a/source3/libsmb/samlogon_cache.c +++ b/source3/libsmb/samlogon_cache.c @@ -179,7 +179,7 @@ bool netsamlogon_cache_store(const char *username, struct netr_SamInfo3 *info3) data.dsize = blob.length; data.dptr = blob.data; - if (tdb_store_bystring(netsamlogon_tdb, keystr, data, TDB_REPLACE) != -1) { + if (tdb_store_bystring(netsamlogon_tdb, keystr, data, TDB_REPLACE) == 0) { result = true; } diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c index 4477da6a19..e891b960d8 100644 --- a/source3/libsmb/smb_share_modes.c +++ b/source3/libsmb/smb_share_modes.c @@ -344,7 +344,7 @@ int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx, db_data.dsize = sizeof(struct locking_data) + sizeof(struct share_mode_entry) + strlen(sharepath) + 1 + strlen(filename) + 1; - if (tdb_store(db_ctx->smb_tdb, locking_key, db_data, TDB_INSERT) == -1) { + if (tdb_store(db_ctx->smb_tdb, locking_key, db_data, TDB_INSERT) != 0) { free(db_data.dptr); return -1; } @@ -387,7 +387,7 @@ int smb_create_share_mode_entry_ex(struct smbdb_ctx *db_ctx, db_data.dptr = new_data_p; db_data.dsize = new_data_size; - if (tdb_store(db_ctx->smb_tdb, locking_key, db_data, TDB_REPLACE) == -1) { + if (tdb_store(db_ctx->smb_tdb, locking_key, db_data, TDB_REPLACE) != 0) { free(db_data.dptr); return -1; } @@ -510,7 +510,7 @@ int smb_delete_share_mode_entry(struct smbdb_ctx *db_ctx, db_data.dsize = sizeof(struct locking_data) + (num_share_modes * sizeof(struct share_mode_entry)) + remaining_size; - if (tdb_store(db_ctx->smb_tdb, locking_key, db_data, TDB_REPLACE) == -1) { + if (tdb_store(db_ctx->smb_tdb, locking_key, db_data, TDB_REPLACE) != 0) { free(db_data.dptr); return -1; } @@ -565,7 +565,7 @@ int smb_change_share_mode_entry(struct smbdb_ctx *db_ctx, } /* Save modified data. */ - if (tdb_store(db_ctx->smb_tdb, locking_key, db_data, TDB_REPLACE) == -1) { + if (tdb_store(db_ctx->smb_tdb, locking_key, db_data, TDB_REPLACE) != 0) { free(db_data.dptr); return -1; } diff --git a/source3/printing/nt_printing_tdb.c b/source3/printing/nt_printing_tdb.c index e5ae59081b..8d8d6f7dc7 100644 --- a/source3/printing/nt_printing_tdb.c +++ b/source3/printing/nt_printing_tdb.c @@ -245,7 +245,7 @@ static int sec_desc_upg_fn( TDB_CONTEXT *the_tdb, TDB_DATA key, /* 0 to continue and non-zero to stop traversal */ - return (result == -1); + return (result != 0); } /******************************************************************* diff --git a/source3/printing/printing.c b/source3/printing/printing.c index 2e5dbcfab2..6dbb560e43 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -624,7 +624,7 @@ static bool remove_from_jobs_changed(const char* sharename, uint32_t jobid) if (i < job_count -1 ) memmove(data.dptr + (i*4), data.dptr + (i*4) + 4, (job_count - i - 1)*4 ); data.dsize -= 4; - if (tdb_store(pdb->tdb, key, data, TDB_REPLACE) == -1) + if (tdb_store(pdb->tdb, key, data, TDB_REPLACE) != 0) goto out; break; } @@ -1919,7 +1919,7 @@ bool print_notify_register_pid(int snum) } /* Store back the record. */ - if (tdb_store_bystring(tdb, NOTIFY_PID_LIST_KEY, data, TDB_REPLACE) == -1) { + if (tdb_store_bystring(tdb, NOTIFY_PID_LIST_KEY, data, TDB_REPLACE) != 0) { DEBUG(0,("print_notify_register_pid: Failed to update pid \ list for printer %s\n", printername)); goto done; @@ -2009,7 +2009,7 @@ printer %s database\n", printername)); SAFE_FREE(data.dptr); /* Store back the record. */ - if (tdb_store_bystring(tdb, NOTIFY_PID_LIST_KEY, data, TDB_REPLACE) == -1) { + if (tdb_store_bystring(tdb, NOTIFY_PID_LIST_KEY, data, TDB_REPLACE) != 0) { DEBUG(0,("print_notify_register_pid: Failed to update pid \ list for printer %s\n", printername)); goto done; @@ -2153,7 +2153,7 @@ static bool remove_from_jobs_added(const char* sharename, uint32 jobid) if (i < job_count -1 ) memmove(data.dptr + (i*4), data.dptr + (i*4) + 4, (job_count - i - 1)*4 ); data.dsize -= 4; - if (tdb_store(pdb->tdb, key, data, TDB_REPLACE) == -1) + if (tdb_store(pdb->tdb, key, data, TDB_REPLACE) != 0) goto out; break; } @@ -2622,7 +2622,7 @@ static WERROR allocate_print_jobid(struct tdb_print_db *pdb, int snum, dum.dptr = NULL; dum.dsize = 0; if (tdb_store(pdb->tdb, print_key(jobid, &tmp), dum, - TDB_INSERT) == -1) { + TDB_INSERT) != 0) { DEBUG(3, ("allocate_print_jobid: " "jobid (%d) failed to store placeholder.\n", jobid )); |