registry: improve logic for deleting value records in regdb_store_keys().
authorMichael Adam <obnox@samba.org>
Wed, 9 Jul 2008 08:39:00 +0000 (10:39 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 9 Jul 2008 08:43:25 +0000 (10:43 +0200)
Don't ignore all errors from dbwrap_delete_bystring() but
only NT_STATUS_NOT_FOUND.

Michael
(This used to be commit d7ec9b2d52d1eddd98eba222f723fb6cdff4541f)

source3/registry/reg_backend_db.c

index b1e3e2b5a3c7b536658704d88f2ff403157eaa8d..3f06fba5c2b71928f4dc268d3b0d07195bcf7d72 100644 (file)
@@ -701,8 +701,15 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
                if (!path) {
                        goto cancel;
                }
-               /* Ignore errors here, we might have no values around */
-               dbwrap_delete_bystring(regdb, path);
+               status = dbwrap_delete_bystring(regdb, path);
+               /* Don't fail if there are no values around. */
+               if (!NT_STATUS_IS_OK(status) &&
+                   !NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND))
+               {
+                       DEBUG(1, ("Deleting %s failed: %s\n", path,
+                                 nt_errstr(status)));
+                       goto cancel;
+               }
                TALLOC_FREE(path);
 
                /* (c) Delete the list of subkeys of this key */