From 158a2eed334512c28a7101b3af2c364b4ac1b3fd Mon Sep 17 00:00:00 2001 From: Andrew Kroeger Date: Fri, 18 Jan 2008 01:48:48 +0100 Subject: registry: Properly check return values from ldb_*() functions. There were a few cases left that attempted to detect errors from ldb_*() function calls using "(ret < 0)". As all LDB_* error codes are greater than zero, there was no chance any errors would be detected. Changed all such tests to use "(ret != LDB_SUCCESS)". (This used to be commit 0ed6f1b1628da5b922f02a5f9a6c60071b6277f2) --- source4/lib/registry/ldb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/lib/registry') diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index d56b63299d..d87bc6cf8e 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -400,7 +400,7 @@ static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent, talloc_strdup(mem_ctx, classname)); ret = ldb_add(parentkd->ldb, msg); - if (ret < 0) { + if (ret != LDB_SUCCESS) { DEBUG(1, ("ldb_msg_add: %s\n", ldb_errstring(parentkd->ldb))); return WERR_FOOBAR; } @@ -432,7 +432,7 @@ static WERROR ldb_del_key(const struct hive_key *key, const char *child) if (ret == LDB_ERR_NO_SUCH_OBJECT) { return WERR_NOT_FOUND; - } else if (ret < 0) { + } else if (ret != LDB_SUCCESS) { DEBUG(1, ("ldb_del_key: %s\n", ldb_errstring(parentkd->ldb))); return WERR_FOOBAR; } @@ -455,7 +455,7 @@ static WERROR ldb_del_value (struct hive_key *key, const char *child) if (ret == LDB_ERR_NO_SUCH_OBJECT) { return WERR_NOT_FOUND; - } else if (ret < 0) { + } else if (ret != LDB_SUCCESS) { DEBUG(1, ("ldb_del_value: %s\n", ldb_errstring(kd->ldb))); return WERR_FOOBAR; } -- cgit