From 9646e4d024c05332c9653419abd6c41fdd48a33b Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 29 Mar 2011 08:25:59 -0400 Subject: [PATCH] fix messed-up errno if remove fails for a non-EISDIR reason --- src/stdio/remove.c | 4 ++-- 1 file 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; } -- 2.20.1