Avoid some redundant calls to time(NULL).
touch_key() must not be called in create_key.
diff --git a/server/registry.c b/server/registry.c
index b766308..340c474 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -663,7 +663,6 @@
if (!*path) goto done;
*created = 1;
- touch_key( key, REG_NOTIFY_CHANGE_NAME ); /* FIXME: is this right? */
if (flags & KEY_DIRTY) make_dirty( key );
base = key;
base_idx = index;
@@ -1201,7 +1200,8 @@
/* load and create a key from the input file */
static struct key *load_key( struct key *base, const char *buffer, int flags,
- int prefix_len, struct file_load_info *info )
+ int prefix_len, struct file_load_info *info,
+ int default_modif )
{
WCHAR *p, *name;
int res, len, modif;
@@ -1214,7 +1214,7 @@
file_read_error( "Malformed key", info );
return NULL;
}
- if (sscanf( buffer + res, " %d", &modif ) != 1) modif = time(NULL);
+ if (sscanf( buffer + res, " %d", &modif ) != 1) modif = default_modif;
p = (WCHAR *)info->tmp;
while (prefix_len && *p) { if (*p++ == '\\') prefix_len--; }
@@ -1388,6 +1388,7 @@
struct key *subkey = NULL;
struct file_load_info info;
char *p;
+ int default_modif = time(NULL);
int flags = (key->flags & KEY_VOLATILE) ? KEY_VOLATILE : KEY_DIRTY;
int prefix_len = -1; /* number of key name prefixes to skip */
@@ -1418,7 +1419,7 @@
case '[': /* new key */
if (subkey) release_object( subkey );
if (prefix_len == -1) prefix_len = get_prefix_len( key, p + 1, &info );
- if (!(subkey = load_key( key, p + 1, flags, prefix_len, &info )))
+ if (!(subkey = load_key( key, p + 1, flags, prefix_len, &info, default_modif )))
file_read_error( "Error creating key", &info );
break;
case '@': /* default value */