summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorMart G <martg_@hotmail.com>2021-01-23 13:21:42 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-23 15:26:44 +0100
commit86a9e26996455a3558b3b69ff2bc68454346400b (patch)
treebf29c76212c2133987aad1bde5641e6ee93297b1 /Userland
parent8363b3ae99ad0db2178b7dd76a2365cfba63bafc (diff)
downloadserenity-86a9e26996455a3558b3b69ff2bc68454346400b.zip
LibC: Prevent remove from calling rmdir when unlink succeeds.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibC/stdio.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/Userland/Libraries/LibC/stdio.cpp b/Userland/Libraries/LibC/stdio.cpp
index 6411df4d79..f96f4732ad 100644
--- a/Userland/Libraries/LibC/stdio.cpp
+++ b/Userland/Libraries/LibC/stdio.cpp
@@ -1152,9 +1152,9 @@ int pclose(FILE* stream)
int remove(const char* pathname)
{
int rc = unlink(pathname);
- if (rc < 0 && errno != EISDIR)
- return -1;
- return rmdir(pathname);
+ if (rc < 0 && errno == EISDIR)
+ return rmdir(pathname);
+ return rc;
}
int scanf(const char* fmt, ...)