From bca2677afe0646e5436356d73c4acee7844e8056 Mon Sep 17 00:00:00 2001 From: Gregor Beck Date: Mon, 24 Oct 2011 10:25:29 +0200 Subject: s3:net registry check: adapt to new semantic of dbwrap_fetch Signed-off-by: Michael Adam --- source3/utils/net_registry_check.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/source3/utils/net_registry_check.c b/source3/utils/net_registry_check.c index 2c278319f5..c51a2f02b9 100644 --- a/source3/utils/net_registry_check.c +++ b/source3/utils/net_registry_check.c @@ -893,18 +893,21 @@ dbwrap_store_verbose(struct db_context *db, const char *key, TDB_DATA nval) NTSTATUS status; status = dbwrap_fetch_bystring(db, mem_ctx, key, &oval); - if (!NT_STATUS_IS_OK(status)) { - printf ("store %s failed to fetch old value: %s\n", key, - nt_errstr(status)); - goto done; - } + if (NT_STATUS_IS_OK(status)) { + if (tdb_data_equal(nval, oval)) { + goto done; + } + printf("store %s:\n overwrite: %s\n with: %s\n", key, + tdb_data_print(mem_ctx, oval), + tdb_data_print(mem_ctx, nval)); - if (!tdb_data_is_empty(oval) && !tdb_data_equal(nval, oval)) { - printf("store %s:\n" - " overwrite: %s\n" - " with: %s\n", - key, tdb_data_print(mem_ctx, oval), + } else if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) { + printf("store %s:\n write: %s\n", key, tdb_data_print(mem_ctx, nval)); + } else { + printf ("store %s:\n failed to fetch old value: %s\n", key, + nt_errstr(status)); + goto done; } status = dbwrap_store_bystring(db, key, nval, 0); -- cgit