mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-19 08:51:57 +00:00
LibC: Prevent remove from calling rmdir when unlink succeeds.
This commit is contained in:
parent
8363b3ae99
commit
86a9e26996
Notes:
sideshowbarker
2024-07-18 22:55:53 +09:00
Author: https://github.com/Maato
Commit: 86a9e26996
Pull-request: https://github.com/SerenityOS/serenity/pull/5064
1 changed files with 3 additions and 3 deletions
|
@ -1152,9 +1152,9 @@ int pclose(FILE* stream)
|
||||||
int remove(const char* pathname)
|
int remove(const char* pathname)
|
||||||
{
|
{
|
||||||
int rc = unlink(pathname);
|
int rc = unlink(pathname);
|
||||||
if (rc < 0 && errno != EISDIR)
|
if (rc < 0 && errno == EISDIR)
|
||||||
return -1;
|
return rmdir(pathname);
|
||||||
return rmdir(pathname);
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int scanf(const char* fmt, ...)
|
int scanf(const char* fmt, ...)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue