summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Kramkowski <tomasz@kramkow.ski>2023-01-27 16:02:08 +0000
committerTomasz Kramkowski <tomasz@kramkow.ski>2023-01-27 16:02:08 +0000
commit8226faf4e070c9eacb9c619d8a5346cc4dc1a6ee (patch)
tree585f84b60072d18904b20e4bfaa2dbfd797f3316
parent10e79d4bc7a85ff28ffbcfb1584c80bd5b796eae (diff)
downloadpam_usercg_rust-8226faf4e070c9eacb9c619d8a5346cc4dc1a6ee.tar.gz
pam_usercg_rust-8226faf4e070c9eacb9c619d8a5346cc4dc1a6ee.tar.xz
pam_usercg_rust-8226faf4e070c9eacb9c619d8a5346cc4dc1a6ee.zip
Use match for open_session error handling
-rw-r--r--src/lib.rs7
1 files changed, 3 insertions, 4 deletions
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,
}
}
}