mirror of
https://github.com/uutils/coreutils
synced 2024-10-15 20:34:28 +00:00
Merge pull request #5372 from sanpii/ls-panic
ls: fix panic when file removed too quickly
This commit is contained in:
commit
c53ca6d6fc
|
@ -2889,7 +2889,11 @@ fn classify_file(path: &PathData, out: &mut BufWriter<Stdout>) -> Option<char> {
|
|||
Some('=')
|
||||
} else if file_type.is_fifo() {
|
||||
Some('|')
|
||||
} else if file_type.is_file() && file_is_executable(path.md(out).as_ref().unwrap()) {
|
||||
} else if file_type.is_file()
|
||||
// Safe unwrapping if the file was removed between listing and display
|
||||
// See https://github.com/uutils/coreutils/issues/5371
|
||||
&& path.md(out).map(file_is_executable).unwrap_or_default()
|
||||
{
|
||||
Some('*')
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Reference in a new issue