diff --git a/Userland/Libraries/LibC/stdio.cpp b/Userland/Libraries/LibC/stdio.cpp index e9b8e5631c0..8bc739effd7 100644 --- a/Userland/Libraries/LibC/stdio.cpp +++ b/Userland/Libraries/LibC/stdio.cpp @@ -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; }