From: Karel Zak Date: Tue, 16 Jun 2020 12:00:58 +0000 (+0200) Subject: login: cleanup get_hushlogin_status() use X-Git-Tag: v2.36-rc2~46 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=111b395aedf59d8d15933e82e5d1d6bce80fe3fa;p=thirdparty%2Futil-linux.git login: cleanup get_hushlogin_status() use * use 1 bit for context->quiet * get_hushlogin_status() return -1 on error, make sure we do not interpret it as "hush mode enabled" Signed-off-by: Karel Zak --- diff --git a/login-utils/login.c b/login-utils/login.c index 026c023c92..3f94001848 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -134,9 +134,9 @@ struct login_context { char hostaddress[16]; /* remote address */ pid_t pid; - int quiet; /* 1 if hush file exists */ - unsigned int remote:1, /* login -h */ + unsigned int quiet:1, /* hush file exists */ + remote:1, /* login -h */ nohost:1, /* login -H */ noauth:1, /* login -f */ keep_env:1; /* login -p */ @@ -1339,7 +1339,7 @@ int main(int argc, char **argv) sleepexit(EXIT_FAILURE); } - cxt.quiet = get_hushlogin_status(pwd, 1); + cxt.quiet = get_hushlogin_status(pwd, 1) == 1 ? 1 : 0; /* * Open PAM session (after successful authentication and account check).