summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--common/ini/Makefile.am5
-rw-r--r--common/ini/ini_config.c20
2 files changed, 21 insertions, 4 deletions
diff --git a/common/ini/Makefile.am b/common/ini/Makefile.am
index 76205262d..3d9115cd3 100644
--- a/common/ini/Makefile.am
+++ b/common/ini/Makefile.am
@@ -39,14 +39,15 @@ libini_config_la_SOURCES = \
libini_config_la_LIBADD = \
-L$(topbuilddir)/collection \
- -lcollection
+ -lcollection \
+ -lpath_utils
libini_config_la_LDFLAGS = \
-version-info 2:0:0
# Build unit test
check_PROGRAMS = ini_config_ut
ini_config_ut_SOURCES = ini_config_ut.c
-ini_config_ut_LDADD = libini_config.la -lcollection
+ini_config_ut_LDADD = libini_config.la -lcollection -lpath_utils
if HAVE_DOXYGEN
docs:
diff --git a/common/ini/ini_config.c b/common/ini/ini_config.c
index 76b456e62..66d2c03af 100644
--- a/common/ini/ini_config.c
+++ b/common/ini/ini_config.c
@@ -29,6 +29,7 @@
#include <locale.h>
#include <fcntl.h>
#include <unistd.h>
+#include <limits.h>
#include "config.h"
/* For error text */
#include <libintl.h>
@@ -39,6 +40,7 @@
#include "trace.h"
#include "ini_config.h"
#include "ini_metadata.h"
+#include "path_utils.h"
#define NAME_OVERHEAD 10
@@ -665,6 +667,8 @@ int config_from_fd_with_metadata(const char *application,
int save_error = 0;
int fd = -1;
FILE *config_file = NULL;
+ int can_free = 0;
+ char abs_name[PATH_MAX + 1];
TRACE_FLOW_STRING("config_from_fd_with_metadata", "Entry");
@@ -716,13 +720,25 @@ int config_from_fd_with_metadata(const char *application,
return file_error;
}
+ /* Normalize path for reporting purposes */
+ error = make_normalized_absolute_path(abs_name,
+ PATH_MAX,
+ config_filename);
+ if(error) {
+ TRACE_ERROR_NUMBER("Failed to resolve path", error);
+ fclose(config_file);
+ return error;
+ }
+
+
/* Collect meta data before actually parsing the file */
error = collect_metadata(metaflags,
metadata,
config_file,
- config_filename);
+ abs_name);
if(error) {
TRACE_ERROR_NUMBER("Failed to collect metadata", error);
+ fclose(config_file);
return error;
}
@@ -730,7 +746,7 @@ int config_from_fd_with_metadata(const char *application,
/* Parse data if needed */
error = config_with_metadata(application,
config_file,
- config_filename,
+ abs_name,
ini_config,
error_level,
error_list,