summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/stdio.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-09 21:49:10 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-09 21:49:49 +0200
commitc93687c15e27b6af51d34afa7233e0fb31bff7cd (patch)
tree29337666b515cb05b4a74bab251a80a5b534fafa /Userland/Libraries/LibC/stdio.cpp
parent1864b2b82856b332e323cdf167708abee9667040 (diff)
downloadserenity-c93687c15e27b6af51d34afa7233e0fb31bff7cd.zip
LibC: Make remove() propagate non-EISDIR unlink() errors
Regressed in 16105091ba5cb8e9d81eabcb499e70b1907ffc08.
Diffstat (limited to 'Userland/Libraries/LibC/stdio.cpp')
-rw-r--r--Userland/Libraries/LibC/stdio.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Libraries/LibC/stdio.cpp b/Userland/Libraries/LibC/stdio.cpp
index e9b8e5631c..8bc739effd 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;
}