summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2011-02-15 18:16:43 +0100
committerVolker Lendecke <vlendec@samba.org>2011-02-15 19:11:25 +0100
commit4b354e67fc7adce5152c73697bbf02a1aac69b20 (patch)
treebbfe12f25c6129f87d511d48e763587b2b18311d /source3
parent20197c6687f83154aefa33706829af08d1d5c50a (diff)
downloadsamba-4b354e67fc7adce5152c73697bbf02a1aac69b20.tar.gz
samba-4b354e67fc7adce5152c73697bbf02a1aac69b20.tar.bz2
samba-4b354e67fc7adce5152c73697bbf02a1aac69b20.zip
s3-amend: Don't overwrite existing values
This saves a ton of tdb transactions on smbd startup Andreas, Günther, please check! Autobuild-User: Volker Lendecke <vlendec@samba.org> Autobuild-Date: Tue Feb 15 19:11:25 CET 2011 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/registry/reg_api.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c
index acce7ab1b4..7c2e01dccc 100644
--- a/source3/registry/reg_api.c
+++ b/source3/registry/reg_api.c
@@ -659,6 +659,7 @@ done:
WERROR reg_setvalue(struct registry_key *key, const char *name,
const struct registry_value *val)
{
+ struct regval_blob *existing;
WERROR err;
int res;
@@ -670,6 +671,15 @@ WERROR reg_setvalue(struct registry_key *key, const char *name,
return err;
}
+ existing = regval_ctr_getvalue(key->values, name);
+
+ if ((existing != NULL) &&
+ (regval_size(existing) == val->data.length) &&
+ (memcmp(regval_data_p(existing), val->data.data,
+ val->data.length) == 0)) {
+ return WERR_OK;
+ }
+
res = regval_ctr_addvalue(key->values, name, val->type,
val->data.data, val->data.length);