rm: Exit with status 0 if stat fails and force is set

This commit is contained in:
Wesley Moore 2020-10-23 18:06:11 +11:00 committed by Andreas Kling
parent 46c15276e9
commit 5ee7e9ab64
Notes: sideshowbarker 2024-07-19 01:47:37 +09:00

View file

@ -41,7 +41,7 @@ static int remove(bool recursive, bool force, String path)
if (lstat(path.characters(), &path_stat) < 0) {
if (!force)
perror("lstat");
return 1;
return force ? 0 : 1;
}
if (S_ISDIR(path_stat.st_mode) && recursive) {