]> git.sesse.net Git - bcachefs-tools-debian/commitdiff
cmd_mount: request passphrase if the existing key is revoked
authorColin Gillespie <colin@cgillespie.xyz>
Fri, 8 Sep 2023 07:27:52 +0000 (17:27 +1000)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 8 Sep 2023 08:05:39 +0000 (04:05 -0400)
Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
rust-src/src/key.rs

index 07292e8ccea6e3a23b97ac1267ffc0a72e7a4625..9319351ee84572ed8cba5de3ba78663248870421 100644 (file)
@@ -41,10 +41,11 @@ fn check_for_key(key_name: &std::ffi::CStr) -> anyhow::Result<bool> {
     if key_id > 0 {
         info!("Key has became available");
         Ok(true)
-    } else if errno::errno().0 != libc::ENOKEY {
-        Err(crate::ErrnoError(errno::errno()).into())
     } else {
-        Ok(false)
+        match errno::errno().0 {
+            libc::ENOKEY | libc::EKEYREVOKED => Ok(false),
+            _ => Err(crate::ErrnoError(errno::errno()).into()),
+        }
     }
 }