mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
rm: added check for write protected regular empty file
Signed-off-by: Stefin <stefin@pm.me>
This commit is contained in:
parent
4c1c9ebf89
commit
a33bc185a5
1 changed files with 9 additions and 1 deletions
|
@ -420,7 +420,15 @@ fn prompt_write_protected(path: &Path, is_dir: bool, options: &Options) -> bool
|
||||||
if is_dir {
|
if is_dir {
|
||||||
prompt(&(format!("rm: remove write-protected directory {}? ", path.quote())))
|
prompt(&(format!("rm: remove write-protected directory {}? ", path.quote())))
|
||||||
} else {
|
} else {
|
||||||
prompt(&(format!("rm: remove write-protected file {}? ", path.quote())))
|
if fs::metadata(path).unwrap().len() == 0 {
|
||||||
|
return prompt(
|
||||||
|
&(format!(
|
||||||
|
"rm: remove write-protected regular empty file {}? ",
|
||||||
|
path.quote()
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
prompt(&(format!("rm: remove write-protected regular file {}? ", path.quote())))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
true
|
true
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue