From: Martin Mares Date: Sun, 14 Oct 2018 19:33:12 +0000 (+0200) Subject: Added --no-fork option X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=2d12407af2d5aa13817547eb558d53c8c798c970;p=ursary.git Added --no-fork option --- diff --git a/ursaryd.c b/ursaryd.c index 421c701..c15db3d 100644 --- a/ursaryd.c +++ b/ursaryd.c @@ -651,6 +651,7 @@ void notify_touch(int rotary, int on UNUSED) /*** Main entry point ***/ static int debug; +static int no_fork; static struct opt_section options = { OPT_ITEMS { @@ -659,6 +660,7 @@ static struct opt_section options = { OPT_HELP("Options:"), OPT_HELP_OPTION, OPT_BOOL('d', "debug", debug, 0, "\tEnable debugging mode (no fork etc.)"), + OPT_BOOL(0, "no-fork", no_fork, 0, "\tDo not fork\n"), OPT_END } }; @@ -696,7 +698,7 @@ int main(int argc UNUSED, char **argv) unsetenv("HOME"); struct daemon_params dp = { - .flags = (debug ? DAEMON_FLAG_SIMULATE : 0), + .flags = ((debug || no_fork) ? DAEMON_FLAG_SIMULATE : 0), .pid_file = "/run/ursaryd.pid", .run_as_user = "ursary", };