summaryrefslogtreecommitdiff
path: root/src/stdio/remove.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-03-29 08:25:59 -0400
committerRich Felker <dalias@aerifal.cx>2011-03-29 08:25:59 -0400
commit9646e4d024c05332c9653419abd6c41fdd48a33b (patch)
treee51dcec0116e9fc0c151e8096f5fa782fda053ba /src/stdio/remove.c
parent0b240ccf523b9af23dd1efa78274f397fcc90cdd (diff)
downloadmusl-9646e4d024c05332c9653419abd6c41fdd48a33b.tar.gz
fix messed-up errno if remove fails for a non-EISDIR reason
Diffstat (limited to 'src/stdio/remove.c')
-rw-r--r--src/stdio/remove.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/stdio/remove.c b/src/stdio/remove.c
index fc12f7c1..e147ba25 100644
--- a/src/stdio/remove.c
+++ b/src/stdio/remove.c
@@ -4,6 +4,6 @@
int remove(const char *path)
{
- return (syscall(SYS_unlink, path) && errno == EISDIR)
- ? syscall(SYS_rmdir, path) : 0;
+ int r = syscall(SYS_unlink, path);
+ return (r && errno == EISDIR) ? syscall(SYS_rmdir, path) : r;
}