diff --git a/sudo.c b/sudo.c index fd209d70f..e73013bec 100644 --- a/sudo.c +++ b/sudo.c @@ -887,7 +887,8 @@ set_loginclass(pw) lc = login_getclass(login_class); if (!lc || !lc->lc_class || strcmp(lc->lc_class, login_class) != 0) { log_error(errflags, "unknown login class: %s", login_class); - lc = login_getclass(NULL); /* Fall back on default login class */ + if (!lc) + lc = login_getclass(NULL); /* needed for login_getstyle() later */ } } #else