mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
added better error message in case of invalid config file path
This commit is contained in:
parent
5320830b13
commit
ecc8e16552
1 changed files with 8 additions and 1 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <string.h>
|
||||
#include <libgen.h>
|
||||
#include <dlfcn.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "list.h"
|
||||
|
@ -32,8 +33,14 @@ int config_parse(const char *filename, config_t *cfg, struct settings *set,
|
|||
config_set_include_dir(cfg, include_dir);
|
||||
|
||||
free(filename_cpy);
|
||||
|
||||
if (strcmp("-", filename) == 0)
|
||||
ret = config_read(cfg, stdin);
|
||||
else if (access(filename, F_OK) != -1)
|
||||
ret = config_read_file(cfg, filename);
|
||||
else
|
||||
error("Invalid configuration file name: %s", filename);
|
||||
|
||||
ret = strcmp("-", filename) ? config_read_file(cfg, filename) : config_read(cfg, stdin);
|
||||
if (ret != CONFIG_TRUE) {
|
||||
error("Failed to parse configuration: %s in %s:%d",
|
||||
config_error_text(cfg),
|
||||
|
|
Loading…
Add table
Reference in a new issue