From 3a0c0fe1c8b2242250735675b64114fadbfc0aee Mon Sep 17 00:00:00 2001 From: Clemens Lang Date: Sun, 21 Sep 2014 17:49:16 +0200 Subject: Accept EPERM as valid error code for access(2) This is useful on OS X when its sandboxing mechanism is used, because that will set errno = EPERM when a file can't be written due to sandboxing (as opposed to setting it to EACCES when file permissions deny writing). --- System/Posix/Files.hsc | 3 ++- System/Posix/Files/ByteString.hsc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'System') diff --git a/System/Posix/Files.hsc b/System/Posix/Files.hsc index c8b5ddf..7c20987 100644 --- a/System/Posix/Files.hsc +++ b/System/Posix/Files.hsc @@ -152,7 +152,8 @@ access name flags = if (r == 0) then return True else do err <- getErrno - if (err == eACCES || err == eROFS || err == eTXTBSY) + if (err == eACCES || err == eROFS || err == eTXTBSY || + err == ePERM) then return False else throwErrnoPath "fileAccess" name diff --git a/System/Posix/Files/ByteString.hsc b/System/Posix/Files/ByteString.hsc index 1b346a7..dc1a3f8 100644 --- a/System/Posix/Files/ByteString.hsc +++ b/System/Posix/Files/ByteString.hsc @@ -158,7 +158,8 @@ access name flags = if (r == 0) then return True else do err <- getErrno - if (err == eACCES || err == eROFS || err == eTXTBSY) + if (err == eACCES || err == eROFS || err == eTXTBSY || + err == ePERM) then return False else throwErrnoPath "fileAccess" name -- cgit v1.2.3