case 'L': /* no detach */
#ifndef HAVE_MLOCKALL
logger(DEBUG_ALWAYS, LOG_ERR, "The %s option is not supported on this platform.", argv[optind - 1]);
case 'L': /* no detach */
#ifndef HAVE_MLOCKALL
logger(DEBUG_ALWAYS, LOG_ERR, "The %s option is not supported on this platform.", argv[optind - 1]);
case 'R':
case 'U':
logger(DEBUG_ALWAYS, LOG_ERR, "The %s option is not supported on this platform.", argv[optind - 1]);
case 'R':
case 'U':
logger(DEBUG_ALWAYS, LOG_ERR, "The %s option is not supported on this platform.", argv[optind - 1]);
if(optind < argc) {
fprintf(stderr, "%s: unrecognized argument '%s'\n", argv[0], argv[optind]);
usage(true);
if(optind < argc) {
fprintf(stderr, "%s: unrecognized argument '%s'\n", argv[0], argv[optind]);
usage(true);
if(netname && !check_netname(netname, false)) {
fprintf(stderr, "Invalid character in netname!\n");
if(netname && !check_netname(netname, false)) {
fprintf(stderr, "Invalid character in netname!\n");
- if(initgroups(switchuser, pw->pw_gid) != 0 ||
+ // The second parameter to initgroups on macOS requires int,
+ // but __gid_t is unsigned int. There's not much we can do here.
+ if(initgroups(switchuser, pw->pw_gid) != 0 || // NOLINT(bugprone-narrowing-conversions)
setgid(pw->pw_gid) != 0) {
logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s",
"initgroups", strerror(errno));
setgid(pw->pw_gid) != 0) {
logger(DEBUG_ALWAYS, LOG_ERR, "System call `%s' failed: %s",
"initgroups", strerror(errno));
- if(!debug_level) {
- get_config_int(lookup_config(config_tree, "LogLevel"), &debug_level);
+ if(debug_level == DEBUG_NOTHING) {
+ int level = 0;
+
+ if(get_config_int(lookup_config(config_tree, "LogLevel"), &level)) {
+ debug_level = level;
+ }