+ /* First, try system-wide conf. file. */
+ path = DEFAULT_DAEMON_SYSTEM_CONFIGPATH;
+
+ config_file = fopen(path, "r");
+ if (config_file) {
+ DBG("Loading daemon conf file at %s", path);
+ /*
+ * Return value is not very important here since error or not, we
+ * continue and try the next possible conf. file.
+ */
+ (void) ini_parse_file(config_file,
+ (ini_entry_handler) config_entry_handler_filter,
+ (void *) &filter);
+ fclose(config_file);
+ }
+
+ /* Second is the user local configuration. */
+ path = utils_get_home_dir();
+ if (path) {
+ char fullpath[PATH_MAX];
+
+ ret = snprintf(fullpath, sizeof(fullpath),
+ DEFAULT_DAEMON_HOME_CONFIGPATH, path);
+ if (ret < 0) {
+ PERROR("snprintf user conf. path");
+ goto error;
+ }
+
+ config_file = fopen(fullpath, "r");
+ if (config_file) {
+ DBG("Loading daemon user conf file at %s", path);
+ /*
+ * Return value is not very important here since error or not, we
+ * continue and try the next possible conf. file.
+ */
+ (void) ini_parse_file(config_file,
+ (ini_entry_handler) config_entry_handler_filter,
+ (void *) &filter);
+ fclose(config_file);
+ }
+ }
+
+ /* Final path is the one that the user might have provided. */