From 21d7dd52f3b6be59d00a16852f5f2a65b005b254 Mon Sep 17 00:00:00 2001 From: Stefan Ritt Date: Tue, 8 Aug 2006 22:51:20 +0000 Subject: [PATCH] Display proper error message if config file cannot be read SVN revision: 1711 --- src/elogd.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/elogd.c b/src/elogd.c index c9d83837..c9d0660c 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -10489,7 +10489,7 @@ void load_config_section(char *section, char **buffer, char *error) *buffer = NULL; fh = open(config_file, O_RDONLY | O_BINARY); if (fh < 0) { - sprintf(error, "Cannot read configuration file \"%s\"", config_file); + sprintf(error, "Cannot read configuration file \"%s\": %s", config_file, strerror(errno)); return; } length = lseek(fh, 0, SEEK_END); @@ -10612,6 +10612,7 @@ void show_admin_page(LOGBOOK * lbs, char *top_group) load_config_section(section, &buffer, error_str); if (error_str[0]) { + rsprintf("

%s

\n", error_str); rsprintf("\n"); rsprintf("\r\n"); return; @@ -12344,7 +12345,7 @@ int show_download_page(LOGBOOK * lbs, char *path) /* return complete config file */ load_config_section(NULL, &buffer, error_str); if (error_str[0]) { - rsprintf("Error loading configuration file: %s", error_str); + rsprintf("

%s

", error_str); return EL_FILE_ERROR; } @@ -12361,7 +12362,7 @@ int show_download_page(LOGBOOK * lbs, char *path) /* return config */ load_config_section(lbs->name, &buffer, error_str); if (error_str[0]) { - rsprintf("Error loading configuration file: %s", error_str); + rsprintf("

%s

", error_str); return EL_FILE_ERROR; } @@ -12809,7 +12810,7 @@ int show_md5_page(LOGBOOK * lbs) /* calculate MD5 for logbook section in config file */ load_config_section(lbs->name, &buffer, error_str); if (error_str[0]) - rsprintf("Error loading configuration file: %s", error_str); + rsprintf("

%s

", error_str); else { rsprintf("ID: %6d MD5:", 0);