ctdb-daemon: Make some conditions more explicit
authorMartin Schwenke <martin@meltin.net>
Wed, 29 Jan 2020 05:26:03 +0000 (16:26 +1100)
committerAmitay Isaacs <amitay@samba.org>
Mon, 10 Feb 2020 04:07:39 +0000 (04:07 +0000)
These don't need to depend on do_fork.  Child logging should be set up
whenever the daemon is not interactive.  The stdin handler should be
setup whenever test mode is enabled.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/server/ctdb_daemon.c

index 561d24a189f5ff01970d097e14c9465d4b846bb9..8b4c05887f96d22327d544e8dafceae4ec25b747 100644 (file)
@@ -1497,12 +1497,12 @@ int ctdb_start_daemon(struct ctdb_context *ctdb,
                exit(1);
        }
 
-       if (do_fork) {
+       if (!interactive) {
                ctdb_set_child_logging(ctdb);
        }
 
        /* Exit if stdin is closed */
-       if (!do_fork) {
+       if (test_mode_enabled) {
                ret = setup_stdin_handler(ctdb);
                if (ret != 0) {
                        DBG_ERR("Failed to setup stdin handler\n");