ctdb-common: Allow boolean configuration values to have yes/no values
authorMartin Schwenke <martin@meltin.net>
Mon, 20 Aug 2018 03:43:38 +0000 (13:43 +1000)
committerAmitay Isaacs <amitay@samba.org>
Fri, 24 Aug 2018 08:59:21 +0000 (10:59 +0200)
This make the new configuration style more consistent with the old one.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13589

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

index 74af7f8a048a9fda598dc4e2f2f2ef5f1e1e95e1..669ac23a74bbef2ae8991355c6416a447a22e3a3 100644 (file)
@@ -122,12 +122,12 @@ static int string_to_integer(const char *str, int *int_val)
 
 static int string_to_boolean(const char *str, bool *bool_val)
 {
-       if (strcasecmp(str, "true") == 0) {
+       if (strcasecmp(str, "true") == 0 || strcasecmp(str, "yes") == 0) {
                *bool_val = true;
                return 0;
        }
 
-       if (strcasecmp(str, "false") == 0) {
+       if (strcasecmp(str, "false") == 0 || strcasecmp(str, "no") == 0) {
                *bool_val = false;
                return 0;
        }