mirror of
https://gitea.psi.ch/ELOG/elog.git
synced 2026-09-08 17:13:56 +00:00
Display proper error message if config file cannot be read
SVN revision: 1711
This commit is contained in:
parent
78cfa33a43
commit
21d7dd52f3
@ -10489,7 +10489,7 @@ void load_config_section(char *section, char **buffer, char *error)
|
|||||||
*buffer = NULL;
|
*buffer = NULL;
|
||||||
fh = open(config_file, O_RDONLY | O_BINARY);
|
fh = open(config_file, O_RDONLY | O_BINARY);
|
||||||
if (fh < 0) {
|
if (fh < 0) {
|
||||||
sprintf(error, "Cannot read configuration file <b>\"%s\"</b>", config_file);
|
sprintf(error, "Cannot read configuration file \"%s\": %s", config_file, strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
length = lseek(fh, 0, SEEK_END);
|
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);
|
load_config_section(section, &buffer, error_str);
|
||||||
|
|
||||||
if (error_str[0]) {
|
if (error_str[0]) {
|
||||||
|
rsprintf("<h2>%s</h2>\n", error_str);
|
||||||
rsprintf("</table></td></tr></table>\n");
|
rsprintf("</table></td></tr></table>\n");
|
||||||
rsprintf("</body></html>\r\n");
|
rsprintf("</body></html>\r\n");
|
||||||
return;
|
return;
|
||||||
@ -12344,7 +12345,7 @@ int show_download_page(LOGBOOK * lbs, char *path)
|
|||||||
/* return complete config file */
|
/* return complete config file */
|
||||||
load_config_section(NULL, &buffer, error_str);
|
load_config_section(NULL, &buffer, error_str);
|
||||||
if (error_str[0]) {
|
if (error_str[0]) {
|
||||||
rsprintf("Error loading configuration file: %s", error_str);
|
rsprintf("<h2>%s</h2>", error_str);
|
||||||
return EL_FILE_ERROR;
|
return EL_FILE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12361,7 +12362,7 @@ int show_download_page(LOGBOOK * lbs, char *path)
|
|||||||
/* return config */
|
/* return config */
|
||||||
load_config_section(lbs->name, &buffer, error_str);
|
load_config_section(lbs->name, &buffer, error_str);
|
||||||
if (error_str[0]) {
|
if (error_str[0]) {
|
||||||
rsprintf("Error loading configuration file: %s", error_str);
|
rsprintf("<h2>%s</h2>", error_str);
|
||||||
return EL_FILE_ERROR;
|
return EL_FILE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -12809,7 +12810,7 @@ int show_md5_page(LOGBOOK * lbs)
|
|||||||
/* calculate MD5 for logbook section in config file */
|
/* calculate MD5 for logbook section in config file */
|
||||||
load_config_section(lbs->name, &buffer, error_str);
|
load_config_section(lbs->name, &buffer, error_str);
|
||||||
if (error_str[0])
|
if (error_str[0])
|
||||||
rsprintf("Error loading configuration file: %s", error_str);
|
rsprintf("<h2>%s</h2>", error_str);
|
||||||
else {
|
else {
|
||||||
rsprintf("ID: %6d MD5:", 0);
|
rsprintf("ID: %6d MD5:", 0);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user