Browse code

cfg_get_by_name() returns an error instead of the incorrect value if a fix-up function is defined

Miklos Tirpak authored on 11/01/2008 15:15:19
Showing 1 changed files
... ...
@@ -731,6 +731,13 @@ int cfg_get_by_name(cfg_ctx_t *ctx, str *group_name, str *var_name,
731 731
 	if (cfg_lookup_var(group_name, var_name, &group, &var))
732 732
 		return -1;
733 733
 
734
+	if (var->def->on_change_cb) {
735
+		/* The variable cannot be retrieved, because the fixup
736
+		function may have changed it, and it is better to return
737
+		an error than an incorrect value */
738
+		return -1;
739
+	}
740
+
734 741
 	/* use the module's handle to access the variable
735 742
 	It means that the variable is read from the local config
736 743
 	after forking */