summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2014-05-27 01:27:10 +0200
committerSimon Rettberg2014-05-27 01:27:10 +0200
commit6086de1746be753ac2b720fd7eca3e7da31ad2cc (patch)
treef0f982347e7caa36004da35b3abcee7f53c18219
parentDaemonize, ignore home if empty (diff)
downloadldadp-6086de1746be753ac2b720fd7eca3e7da31ad2cc.tar.gz
ldadp-6086de1746be753ac2b720fd7eca3e7da31ad2cc.tar.xz
ldadp-6086de1746be753ac2b720fd7eca3e7da31ad2cc.zip
daemon optional
-rw-r--r--ldadp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ldadp.c b/ldadp.c
index 2cfbed0..00a3f05 100644
--- a/ldadp.c
+++ b/ldadp.c
@@ -18,11 +18,17 @@ static void loadConfig(char *file);
int main(int argc, char **argv)
{
+ BOOL isdaemon = TRUE;
if (argc < 2) {
printf("Nö\n");
exit(1);
}
signal(SIGPIPE, SIG_IGN);
+ if (strcmp(argv[1], "-n") == 0 && argc > 2) {
+ isdaemon = FALSE;
+ argv++;
+ argc--;
+ }
loadConfig(argv[1]);
proxy_init();
char listen_addr[4] = {0, 0, 0, 0};
@@ -40,7 +46,7 @@ int main(int argc, char **argv)
// Init AD uplinks
server_initServers();
// Daeaeaemon
- if (daemon(1, 0) == -1) bail("daemon() failed.");
+ if (isdaemon && daemon(1, 0) == -1) bail("daemon() failed.");
// Do the mainloop
for (;;) {
if (ePoll_wait(-1) == -1) bail("ePoll wait failed.");