From: Rich Felker Date: Tue, 29 Mar 2011 12:25:59 +0000 (-0400) Subject: fix messed-up errno if remove fails for a non-EISDIR reason X-Git-Url: http://nsz.repo.hu/git/?p=musl;a=commitdiff_plain;h=9646e4d024c05332c9653419abd6c41fdd48a33b;hp=0b240ccf523b9af23dd1efa78274f397fcc90cdd fix messed-up errno if remove fails for a non-EISDIR reason --- 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; }