瀏覽代碼

fix messed-up errno if remove fails for a non-EISDIR reason

Rich Felker 14 年之前
父節點
當前提交
9646e4d024
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/stdio/remove.c

+ 2 - 2
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;
 }