diff options
author | Simon Rettberg | 2014-05-26 19:58:01 +0200 |
---|---|---|
committer | Simon Rettberg | 2014-05-26 19:58:01 +0200 |
commit | b1ae3695f9eaba5e53744718b0758ea2819414f1 (patch) | |
tree | 15f8d019bd5d55b843f194c1f4289a8f80d29e4d | |
parent | Support more AD attributes (diff) | |
download | ldadp-b1ae3695f9eaba5e53744718b0758ea2819414f1.tar.gz ldadp-b1ae3695f9eaba5e53744718b0758ea2819414f1.tar.xz ldadp-b1ae3695f9eaba5e53744718b0758ea2819414f1.zip |
Daemonize, ignore home if empty
-rw-r--r-- | ldadp.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -11,6 +11,7 @@ #include <string.h> #include <stdlib.h> #include <signal.h> +#include <unistd.h> static void listen_callback(void *data, int haveIn, int haveOut, int doCleanup); static void loadConfig(char *file); @@ -38,6 +39,8 @@ int main(int argc, char **argv) if (ePoll_add(EPOLLIN, (epoll_item_t*)&lsn) == -1) bail("Could not add listen socket to epoll fd"); // Init AD uplinks server_initServers(); + // Daeaeaemon + if (daemon(1, 0) == -1) bail("daemon() failed."); // Do the mainloop for (;;) { if (ePoll_wait(-1) == -1) bail("ePoll wait failed."); @@ -75,7 +78,7 @@ static int loadConfig_handler(void *stuff, const char *section, const char *key, if (strcmp(key, "base") == 0) { server_setBase(section, value); } - if (strcmp(key, "home") == 0) { + if (strcmp(key, "home") == 0 && *value != '\0') { server_setHomeTemplate(section, value); } return 1; |