detect_log_level(): return -1 to indicate invalid log level

0 is EMERG, which is not actually used but is valid. Prior to this
change, repmgr would complain about an invalid log level if set to
this.
This commit is contained in:
Ian Barwick
2015-11-13 19:39:43 +09:00
parent 3848b9011b
commit d192d5665c

4
log.c
View File

@@ -112,7 +112,7 @@ logger_init(t_configuration_options * opts, const char *ident, const char *level
printf("Assigned level for logger: %d\n", l);
#endif
if (l > 0)
if (l >= 0)
log_level = l;
else
stderr_log_warning(_("Invalid log level \"%s\" (available values: DEBUG, INFO, NOTICE, WARNING, ERR, ALERT, CRIT or EMERG)\n"), level);
@@ -237,7 +237,7 @@ detect_log_level(const char *level)
if (!strcmp(level, "EMERG"))
return LOG_EMERG;
return 0;
return -1;
}
int