From 86a9e26996455a3558b3b69ff2bc68454346400b Mon Sep 17 00:00:00 2001 From: Mart G Date: Sat, 23 Jan 2021 13:21:42 +0100 Subject: [PATCH] LibC: Prevent remove from calling rmdir when unlink succeeds. --- Userland/Libraries/LibC/stdio.cpp | 6 +++--- 1 file 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, ...)