LibC: Make remove() propagate non-EISDIR unlink() errors

Regressed in 16105091ba.
This commit is contained in:
Andreas Kling 2021-09-09 21:49:10 +02:00
parent 1864b2b828
commit c93687c15e

View file

@ -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;
}