LibC: Make remove() propagate non-EISDIR unlink() errors
Regressed in 16105091ba
.
This commit is contained in:
parent
1864b2b828
commit
c93687c15e
Notes:
sideshowbarker
2024-07-18 04:22:00 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/c93687c15e2
1 changed files with 5 additions and 2 deletions
|
@ -1236,8 +1236,11 @@ int pclose(FILE* stream)
|
|||
|
||||
int remove(const char* pathname)
|
||||
{
|
||||
if (unlink(pathname) < 0 && errno == EISDIR)
|
||||
return rmdir(pathname);
|
||||
if (unlink(pathname) < 0) {
|
||||
if (errno == EISDIR)
|
||||
return rmdir(pathname);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue