From c93687c15e27b6af51d34afa7233e0fb31bff7cd Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 9 Sep 2021 21:49:10 +0200 Subject: [PATCH] LibC: Make remove() propagate non-EISDIR unlink() errors Regressed in 16105091ba5cb8e9d81eabcb499e70b1907ffc08. --- Userland/Libraries/LibC/stdio.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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; }