diff options
author | Simon Rettberg | 2015-10-15 11:36:00 +0200 |
---|---|---|
committer | Simon Rettberg | 2015-10-15 11:36:00 +0200 |
commit | 0257cf7ba624830840f9634e35ab9a507b85ef31 (patch) | |
tree | fddec3b504cc384a2d94e812d04e2aac427cf4c6 | |
parent | Update connection timeout properly (diff) | |
download | ldadp-0257cf7ba624830840f9634e35ab9a507b85ef31.tar.gz ldadp-0257cf7ba624830840f9634e35ab9a507b85ef31.tar.xz ldadp-0257cf7ba624830840f9634e35ab9a507b85ef31.zip |
Bail out if config file is not readable
-rw-r--r-- | ldadp.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -15,7 +15,7 @@ #include <unistd.h> static void listen_callback(void *data, int haveIn, int haveOut, int doCleanup); -static void loadConfig(char *file); +static BOOL loadConfig(char *file); static int localPort = 1234; static char *certFile = NULL, *keyFile = NULL; @@ -34,7 +34,7 @@ int main(int argc, char **argv) argv++; argc--; } - loadConfig(argv[1]); + if (!loadConfig(argv[1])) bail("Cannot read config file %s", argv[1]); if (localPort < 1 || localPort > 65535) bail("Invalid port given in config"); proxy_init(); char listen_addr[4] = {0, 0, 0, 0}; @@ -138,8 +138,8 @@ static int loadConfig_handler(void *stuff, const char *section, const char *key, return 1; } -static void loadConfig(char *file) +static BOOL loadConfig(char *file) { - ini_parse(file, &loadConfig_handler, NULL); + return ini_parse(file, &loadConfig_handler, NULL) >= 0; } |