summaryrefslogtreecommitdiff
path: root/lib/tdb/tools
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
commit6bc59d77b64d1ecbe5c906ed2fa80a7b8ca5d420 (patch)
tree616215df22728c5e4e95cf20f80ff62051274531 /lib/tdb/tools
parent1078eb21c49d707ddeef2257353f35c10d131b9f (diff)
downloadsamba-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 'lib/tdb/tools')
-rw-r--r--lib/tdb/tools/tdbrestore.c2
-rw-r--r--lib/tdb/tools/tdbtool.c6
2 files changed, 4 insertions, 4 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