ctdb-daemon: Switch interactive variable to a bool
authorMartin Schwenke <martin@meltin.net>
Tue, 6 Nov 2018 03:06:14 +0000 (14:06 +1100)
committerAmitay Isaacs <amitay@samba.org>
Tue, 6 Nov 2018 06:16:18 +0000 (07:16 +0100)
popt uses an int in place of a bool, so declare an extra int and make
the conversion explicit.

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

index 7cfd30b1a8cb9a41ab000e37d6e6ab1be91835f3..ebe111ddde63c840fd73b4b8274ad2a7a1c2414b 100644 (file)
@@ -152,11 +152,12 @@ static struct ctdb_context *ctdb_init(struct tevent_context *ev)
 int main(int argc, const char *argv[])
 {
        struct ctdb_context *ctdb = NULL;
-       int interactive = 0;
+       int interactive_opt = 0;
+       bool interactive = false;
 
        struct poptOption popt_options[] = {
                POPT_AUTOHELP
-               { "interactive", 'i', POPT_ARG_NONE, &interactive, 0,
+               { "interactive", 'i', POPT_ARG_NONE, &interactive_opt, 0,
                  "don't fork, log to stderr", NULL },
                POPT_TABLEEND
        };
@@ -224,6 +225,8 @@ int main(int argc, const char *argv[])
                }
        }
 
+       interactive = (interactive_opt != 0);
+
        /*
         * Configuration file handling
         */
@@ -372,7 +375,7 @@ int main(int argc, const char *argv[])
        }
 
        /* start the protocol running (as a child) */
-       return ctdb_start_daemon(ctdb, interactive?false:true);
+       return ctdb_start_daemon(ctdb, !interactive);
 
 fail:
        talloc_free(ctdb);