summaryrefslogtreecommitdiffstats
path: root/common/ini/ini_config.c
diff options
context:
space:
mode:
authorDmitri Pal <dpal@redhat.com>2010-03-31 19:49:32 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-04-14 12:15:54 -0400
commit693c44378b5a7b457b31f343730880dee8f271f3 (patch)
tree3c8c0d7d78f839f58531e73ce6794f6cae8ff4d9 /common/ini/ini_config.c
parent539881bc12a01e4307cd474a584c2e30c1c09d9c (diff)
downloadsssd-693c44378b5a7b457b31f343730880dee8f271f3.tar.gz
sssd-693c44378b5a7b457b31f343730880dee8f271f3.tar.xz
sssd-693c44378b5a7b457b31f343730880dee8f271f3.zip
Resolve paths for reporting purposes
Diffstat (limited to 'common/ini/ini_config.c')
-rw-r--r--common/ini/ini_config.c20
1 files changed, 18 insertions, 2 deletions
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,