diff options
author | Jörg Thalheim <joerg@thalheim.io> | 2023-09-23 09:55:20 +0200 |
---|---|---|
committer | Jörg Thalheim <joerg@thalheim.io> | 2023-09-23 09:55:20 +0200 |
commit | 899ea60ccdc1365e6a947e869c92dece986532ea (patch) | |
tree | 0e0269789aa4a641090d969894130926cd3dbcad | |
parent | bb1791d14e64ad83fb57116a24eb913a4946afed (diff) | |
download | rbw-899ea60ccdc1365e6a947e869c92dece986532ea.tar.gz rbw-899ea60ccdc1365e6a947e869c92dece986532ea.zip |
handle eof correctly when reading from pinentry
Just now rbw-agent will spin at 200% cores if pinentry fails, which can have various reasons.
Now it will just terminate correctly when this happens.
-rw-r--r-- | src/pinentry.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/pinentry.rs b/src/pinentry.rs index f7d36c7..e2a83ed 100644 --- a/src/pinentry.rs +++ b/src/pinentry.rs @@ -137,6 +137,14 @@ where .read(&mut data[len..]) .await .map_err(|source| Error::PinentryReadOutput { source })?; + if bytes == 0 { + return Err(Error::PinentryReadOutput { + source: std::io::Error::new( + std::io::ErrorKind::UnexpectedEof, + "unexpected EOF", + ), + }); + } len += bytes; } } |