From 111b395aedf59d8d15933e82e5d1d6bce80fe3fa Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 16 Jun 2020 14:00:58 +0200 Subject: [PATCH] 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 --- login-utils/login.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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). -- 2.47.3