diff --git a/Cargo.lock b/Cargo.lock index 8c19c9a..bc0374a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8,13 +8,13 @@ name = "dbus" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", - "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", + "pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "libc" -version = "0.2.16" +version = "0.2.40" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -23,16 +23,16 @@ version = "0.1.0" dependencies = [ "config-parser 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "dbus 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "pkg-config" -version = "0.3.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] "checksum config-parser 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "427ca29e1432b3bf9a30a738612c97c1ef1326cd063f0bb8921bfd653ed6eb5c" "checksum dbus 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "94d266a872aaf68b50d02083c429a3686935ab6ab54824290509cdc422673eaf" -"checksum libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "408014cace30ee0f767b1c4517980646a573ec61a57957aeeabcac8ac0a02e8d" -"checksum pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8cee804ecc7eaf201a4a207241472cc870e825206f6c031e3ee2a72fa425f2fa" +"checksum libc 0.2.40 (registry+https://github.com/rust-lang/crates.io-index)" = "6fd41f331ac7c5b8ac259b8bf82c75c0fb2e469bbf37d2becbba9a6a2221965b" +"checksum pkg-config 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "110d5ee3593dbb73f56294327fe5668bcc997897097cbc76b51e7aed3f52452f" diff --git a/Cargo.toml b/Cargo.toml index 22e13ee..8b4dd3b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ build = "build.rs" [dependencies] dbus = "0.3" libc = "0.2" -config-parser = "0.1" +config-parser = "0.1.0" [[bin]] name = "lockd" diff --git a/src/daemon.rs b/src/daemon.rs index cdbd910..f090fbe 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -372,6 +372,11 @@ fn actor_main(handles: ActorMainHandles, inbox: Receiver) { } }; apply_config(&config, &handles, &mut state); + }, + CoreMessage::LockCrashed => { + state.locking = true; + state.locked = false; + handles.lockscreen.send(LockMessage::Lock).unwrap(); } } diff --git a/src/lockscreen.rs b/src/lockscreen.rs index 788b79f..a40aaa5 100644 --- a/src/lockscreen.rs +++ b/src/lockscreen.rs @@ -42,6 +42,9 @@ fn lock_command(command: &(String, Vec)) -> Child { } fn actor_lock_instance(core: Sender, mut child: Child) { - child.wait().unwrap(); - core.send(CoreMessage::Unlocked).unwrap(); + if child.wait().unwrap().success() { + core.send(CoreMessage::Unlocked).unwrap(); + } else { + core.send(CoreMessage::LockCrashed).unwrap(); + } } diff --git a/src/msg.rs b/src/msg.rs index d29e71e..a518e99 100644 --- a/src/msg.rs +++ b/src/msg.rs @@ -27,7 +27,8 @@ pub enum CoreMessage { Suspended, QueryFlag(CoreFlag, Sender), AutoLock, - SetAutoLock(bool) + SetAutoLock(bool), + LockCrashed } impl fmt::Debug for CoreMessage { @@ -42,6 +43,7 @@ impl fmt::Debug for CoreMessage { CoreMessage::Suspending => write!(f, "Suspending"), CoreMessage::Suspended => write!(f, "Suspended"), CoreMessage::ReloadConfig => write!(f, "ReloadConfig"), + CoreMessage::LockCrashed => write!(f, "LockCrashed"), CoreMessage::SuspendOnLid(flag) => { write!(f, "SuspendOnLid({:?})", flag)