From 8226faf4e070c9eacb9c619d8a5346cc4dc1a6ee Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Fri, 27 Jan 2023 16:02:08 +0000 Subject: Use match for open_session error handling --- src/lib.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib.rs b/src/lib.rs index 6f68c22..cf93a9c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -53,10 +53,9 @@ impl PamHooks for PAMUserCG { _args: Vec<&CStr>, _flags: PamFlag, ) -> PamResultCode { - if open_session(h).is_ok() { - PamResultCode::PAM_SUCCESS - } else { - PamResultCode::PAM_SESSION_ERR + match open_session(h) { + Ok(()) => PamResultCode::PAM_SUCCESS, + Err(SessionError) => PamResultCode::PAM_SESSION_ERR, } } } -- cgit v1.2.3-54-g00ecf