From 82dc1e2e783815e00a90cd3f681436a80d54a314 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 24 Sep 2012 22:39:08 -0400 Subject: fix handling of EINTR during close() austin group interpretation for defect #529 (http://austingroupbugs.net/view.php?id=529) tightens the requirements on close such that, if it returns with EINTR, the file descriptor must not be closed. the linux kernel developers vehemently disagree with this, and will not change it. we catch and remap EINTR to EINPROGRESS, which the standard allows close() to return when the operation was not finished but the file descriptor has been closed. --- src/unistd/close.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/unistd/close.c b/src/unistd/close.c index 728d729b..e8f813d6 100644 --- a/src/unistd/close.c +++ b/src/unistd/close.c @@ -1,8 +1,11 @@ #include +#include #include "syscall.h" #include "libc.h" int close(int fd) { - return syscall_cp(SYS_close, fd); + int r = __syscall_cp(SYS_close, fd); + if (r == -EINTR) r = -EINPROGRESS; + return __syscall_ret(r); } -- cgit v1.2.1