unix: Ignore failures if errno is EINTR on close(2). Fixes #908.

db4
Doug Coleman 2014-07-07 14:55:13 -07:00
parent 31b8a0e051
commit 0fbe0e5167
1 changed files with 21 additions and 1 deletions

View File

@ -40,9 +40,29 @@ MACRO:: unix-system-call ( quot -- )
] if
] ;
MACRO:: unix-system-call-allow-eintr ( quot -- )
quot inputs :> n
quot first :> word
0 :> ret!
[
n ndup quot call ret!
ret unix-call-failed? [
! Bug #908
! Allow EINTR for close(2)
errno EINTR = [
n narray
errno dup strerror
word unix-system-call-error
] unless
] [
n ndrop
ret
] if
] ;
HOOK: open-file os ( path flags mode -- fd )
: close-file ( fd -- ) [ close ] unix-system-call drop ;
: close-file ( fd -- ) [ close ] unix-system-call-allow-eintr drop ;
FUNCTION: int _exit ( int status ) ;