diff options
author | Volker Lendecke <vl@samba.org> | 2011-01-08 11:51:17 +0100 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2011-01-08 12:39:09 +0100 |
commit | 61b2ac91210a1d34f47cb480c222b9ae64546180 (patch) | |
tree | f415b147fcddaacd9967c4017e2f20584561d63c /source3/services | |
parent | 849816d0dfa18dad6b972f349c2f1d27e5a70a32 (diff) | |
download | samba-61b2ac91210a1d34f47cb480c222b9ae64546180.tar.gz |
s3: Avoid a ton of registry writes at startup
Autobuild-User: Volker Lendecke <vlendec@samba.org>
Autobuild-Date: Sat Jan 8 12:39:09 CET 2011 on sn-devel-104
Diffstat (limited to 'source3/services')
-rw-r--r-- | source3/services/services_db.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source3/services/services_db.c b/source3/services/services_db.c index ca375d22d4..03f7951b7c 100644 --- a/source3/services/services_db.c +++ b/source3/services/services_db.c @@ -270,6 +270,24 @@ static WERROR svcctl_setvalue(struct registry_key *key, struct registry_value *value) { WERROR wresult; + struct registry_value *existing; + + wresult = reg_queryvalue(talloc_tos(), key, name, &existing); + if (W_ERROR_IS_OK(wresult)) { + bool exists; + + exists = ((value->type == existing->type) && + (data_blob_cmp(&value->data, &existing->data) == 0)); + + TALLOC_FREE(existing); + + if (exists) { + /* + * Avoid an expensive write when not necessary + */ + return WERR_OK; + } + } wresult = reg_setvalue(key, name, value); if (!W_ERROR_IS_OK(wresult)) { |