about summary refs log tree commit diff
path: root/src
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
parent0b240ccf523b9af23dd1efa78274f397fcc90cdd (diff)
downloadmusl-9646e4d024c05332c9653419abd6c41fdd48a33b.tar.gz
musl-9646e4d024c05332c9653419abd6c41fdd48a33b.tar.xz
musl-9646e4d024c05332c9653419abd6c41fdd48a33b.zip
fix messed-up errno if remove fails for a non-EISDIR reason
Diffstat (limited to 'src')
-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;
 }