summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/tdb/tools/tdbrestore.c2
-rw-r--r--lib/tdb/tools/tdbtool.c6
-rw-r--r--lib/util/util_tdb.c14
-rw-r--r--lib/util/util_tdb.h10
-rw-r--r--source3/lib/eventlog/eventlog.c4
-rw-r--r--source3/libsmb/samlogon_cache.c2
-rw-r--r--source3/libsmb/smb_share_modes.c8
-rw-r--r--source3/printing/nt_printing_tdb.c2
-rw-r--r--source3/printing/printing.c10
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_index.c2
-rw-r--r--source4/lib/ldb/ldb_tdb/ldb_tdb.c2
-rw-r--r--source4/ntvfs/posix/xattr_tdb.c2
12 files changed, 32 insertions, 32 deletions
diff --git a/lib/tdb/tools/tdbrestore.c b/lib/tdb/tools/tdbrestore.c
index 95ee360647..1daac63db1 100644
--- a/lib/tdb/tools/tdbrestore.c
+++ b/lib/tdb/tools/tdbrestore.c
@@ -170,7 +170,7 @@ static int read_rec(FILE *f, TDB_CONTEXT *tdb, int *eof)
|| (swallow(f, "}\n", NULL) == -1)) {
goto fail;
}
- if (tdb_store(tdb, key, data, TDB_INSERT) == -1) {
+ if (tdb_store(tdb, key, data, TDB_INSERT) != 0) {
fprintf(stderr, "TDB error: %s\n", tdb_errorstr(tdb));
goto fail;
}
diff --git a/lib/tdb/tools/tdbtool.c b/lib/tdb/tools/tdbtool.c
index cd17f79e32..99d4841cf3 100644
--- a/lib/tdb/tools/tdbtool.c
+++ b/lib/tdb/tools/tdbtool.c
@@ -257,7 +257,7 @@ static void insert_tdb(char *keyname, size_t keylen, char* data, size_t datalen)
dbuf.dptr = (unsigned char *)data;
dbuf.dsize = datalen;
- if (tdb_store(tdb, key, dbuf, TDB_INSERT) == -1) {
+ if (tdb_store(tdb, key, dbuf, TDB_INSERT) != 0) {
terror("insert failed");
}
}
@@ -284,7 +284,7 @@ static void store_tdb(char *keyname, size_t keylen, char* data, size_t datalen)
printf("Storing key:\n");
print_rec(tdb, key, dbuf, NULL);
- if (tdb_store(tdb, key, dbuf, TDB_REPLACE) == -1) {
+ if (tdb_store(tdb, key, dbuf, TDB_REPLACE) != 0) {
terror("store failed");
}
}
@@ -363,7 +363,7 @@ static void move_rec(char *keyname, size_t keylen, char* tdbname)
return;
}
- if ( tdb_store( dst_tdb, key, dbuf, TDB_REPLACE ) == -1 ) {
+ if (tdb_store( dst_tdb, key, dbuf, TDB_REPLACE ) != 0) {
terror("failed to move record");
}
else
diff --git a/lib/util/util_tdb.c b/lib/util/util_tdb.c
index 2dd5f9dd5f..304239f951 100644
--- a/lib/util/util_tdb.c
+++ b/lib/util/util_tdb.c
@@ -133,7 +133,7 @@ int32_t tdb_fetch_int32(struct tdb_context *tdb, const char *keystr)
}
/****************************************************************************
- Store a int32_t value by an arbitrary blob key, return 0 on success, -1 on failure.
+ Store a int32_t value by an arbitrary blob key, return 0 on success, -ve on failure.
Input is int32_t in native byte order. Output in tdb is in little-endian.
****************************************************************************/
@@ -150,7 +150,7 @@ int tdb_store_int32_byblob(struct tdb_context *tdb, TDB_DATA key, int32_t v)
}
/****************************************************************************
- Store a int32_t value by string key, return 0 on success, -1 on failure.
+ Store a int32_t value by string key, return 0 on success, -ve on failure.
Input is int32_t in native byte order. Output in tdb is in little-endian.
****************************************************************************/
@@ -190,7 +190,7 @@ bool tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32_t *val
}
/****************************************************************************
- Store a uint32_t value by an arbitrary blob key, return 0 on success, -1 on failure.
+ Store a uint32_t value by an arbitrary blob key, return true on success, false on failure.
Input is uint32_t in native byte order. Output in tdb is in little-endian.
****************************************************************************/
@@ -204,14 +204,14 @@ bool tdb_store_uint32_byblob(struct tdb_context *tdb, TDB_DATA key, uint32_t val
data.dptr = (unsigned char *)&v_store;
data.dsize = sizeof(uint32_t);
- if (tdb_store(tdb, key, data, TDB_REPLACE) == -1)
+ if (tdb_store(tdb, key, data, TDB_REPLACE) != 0)
ret = false;
return ret;
}
/****************************************************************************
- Store a uint32_t value by string key, return 0 on success, -1 on failure.
+ Store a uint32_t value by string key, return true on success, false on failure.
Input is uint32_t in native byte order. Output in tdb is in little-endian.
****************************************************************************/
@@ -220,7 +220,7 @@ bool tdb_store_uint32(struct tdb_context *tdb, const char *keystr, uint32_t valu
return tdb_store_uint32_byblob(tdb, string_term_tdb_data(keystr), value);
}
/****************************************************************************
- Store a buffer by a null terminated string key. Return 0 on success, -1
+ Store a buffer by a null terminated string key. Return 0 on success, -ve
on failure.
****************************************************************************/
@@ -284,7 +284,7 @@ int32_t tdb_change_int32_atomic(struct tdb_context *tdb, const char *keystr, int
/* Increment value for storage and return next time */
val += change_val;
- if (tdb_store_int32(tdb, keystr, val) == -1)
+ if (tdb_store_int32(tdb, keystr, val) != 0)
goto err_out;
ret = 0;
diff --git a/lib/util/util_tdb.h b/lib/util/util_tdb.h
index 92b88bacb4..edffa058d7 100644
--- a/lib/util/util_tdb.h
+++ b/lib/util/util_tdb.h
@@ -63,13 +63,13 @@ int32_t tdb_fetch_int32_byblob(struct tdb_context *tdb, TDB_DATA key);
int32_t tdb_fetch_int32(struct tdb_context *tdb, const char *keystr);
/****************************************************************************
- Store a int32_t value by an arbitrary blob key, return 0 on success, -1 on failure.
+ Store a int32_t value by an arbitrary blob key, return 0 on success, -ve on failure.
Input is int32_t in native byte order. Output in tdb is in little-endian.
****************************************************************************/
int tdb_store_int32_byblob(struct tdb_context *tdb, TDB_DATA key, int32_t v);
/****************************************************************************
- Store a int32_t value by string key, return 0 on success, -1 on failure.
+ Store a int32_t value by string key, return 0 on success, -ve on failure.
Input is int32_t in native byte order. Output in tdb is in little-endian.
****************************************************************************/
int tdb_store_int32(struct tdb_context *tdb, const char *keystr, int32_t v);
@@ -87,19 +87,19 @@ bool tdb_fetch_uint32_byblob(struct tdb_context *tdb, TDB_DATA key, uint32_t *va
bool tdb_fetch_uint32(struct tdb_context *tdb, const char *keystr, uint32_t *value);
/****************************************************************************
- Store a uint32_t value by an arbitrary blob key, return 0 on success, -1 on failure.
+ Store a uint32_t value by an arbitrary blob key, return true on success, false on failure.
Input is uint32_t in native byte order. Output in tdb is in little-endian.
****************************************************************************/
bool tdb_store_uint32_byblob(struct tdb_context *tdb, TDB_DATA key, uint32_t value);
/****************************************************************************
- Store a uint32_t value by string key, return 0 on success, -1 on failure.
+ Store a uint32_t value by string key, return true on success, false on failure.
Input is uint32_t in native byte order. Output in tdb is in little-endian.
****************************************************************************/
bool tdb_store_uint32(struct tdb_context *tdb, const char *keystr, uint32_t value);
/****************************************************************************
- Store a buffer by a null terminated string key. Return 0 on success, -1
+ Store a buffer by a null terminated string key. Return 0 on success, -ve
on failure.
****************************************************************************/
int tdb_store_bystring(struct tdb_context *tdb, const char *keystr, TDB_DATA data, int flags);
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 ));
diff --git a/source4/lib/ldb/ldb_tdb/ldb_index.c b/source4/lib/ldb/ldb_tdb/ldb_index.c
index 45e747379f..0e9f1e75dd 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_index.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_index.c
@@ -294,7 +294,7 @@ static int ltdb_dn_list_store(struct ldb_module *module, struct ldb_dn *dn,
rec.dsize = sizeof(void *);
ret = tdb_store(ltdb->idxptr->itdb, key, rec, TDB_INSERT);
- if (ret == -1) {
+ if (ret != 0) {
return ltdb_err_map(tdb_error(ltdb->idxptr->itdb));
}
return LDB_SUCCESS;
diff --git a/source4/lib/ldb/ldb_tdb/ldb_tdb.c b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
index 77a75a4504..436ef46b33 100644
--- a/source4/lib/ldb/ldb_tdb/ldb_tdb.c
+++ b/source4/lib/ldb/ldb_tdb/ldb_tdb.c
@@ -264,7 +264,7 @@ int ltdb_store(struct ldb_module *module, const struct ldb_message *msg, int flg
}
ret = tdb_store(ltdb->tdb, tdb_key, tdb_data, flgs);
- if (ret == -1) {
+ if (ret != 0) {
ret = ltdb_err_map(tdb_error(ltdb->tdb));
goto done;
}
diff --git a/source4/ntvfs/posix/xattr_tdb.c b/source4/ntvfs/posix/xattr_tdb.c
index 44aced9bee..07b3712215 100644
--- a/source4/ntvfs/posix/xattr_tdb.c
+++ b/source4/ntvfs/posix/xattr_tdb.c
@@ -185,7 +185,7 @@ NTSTATUS push_xattr_blob_tdb_raw(struct tdb_wrap *ea_tdb,
goto done;
}
- if (tdb_store(ea_tdb->tdb, tkey, tdata, TDB_REPLACE) == -1) {
+ if (tdb_store(ea_tdb->tdb, tkey, tdata, TDB_REPLACE) != 0) {
status = NT_STATUS_INTERNAL_DB_CORRUPTION;
}