Skip to content

Commit e0faac7

Browse files
committed
secure_mount: Fix possible infinite loop
Previously, it would be possible to enter an inifite loop when checking for mounted directories in case of error reading a file. This interrupts the loop in case of error. This was raised as a clippy warning. Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
1 parent 51a814f commit e0faac7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

keylime-agent/src/secure_mount.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ fn check_mount(secure_dir: &Path) -> Result<bool> {
3232
let f = BufReader::new(f);
3333
let lines = f.lines();
3434

35-
for line in lines.flatten() {
35+
for line in lines.map_while(std::result::Result::ok) {
3636
let mut iter = line.split(' ');
3737
if let Some(mount_point) = &iter.nth(4) {
3838
if Path::new(mount_point) == secure_dir {

0 commit comments

Comments
 (0)