aboutsummaryrefslogtreecommitdiffhomepage
path: root/System
diff options
context:
space:
mode:
authorGravatar Clemens Lang <neverpanic@gmail.com>2014-09-21 17:49:16 +0200
committerGravatar Clemens Lang <neverpanic@gmail.com>2014-09-21 17:49:16 +0200
commit3a0c0fe1c8b2242250735675b64114fadbfc0aee (patch)
tree5c09043fa531053158af1e0f7cc07b84d26a2679 /System
parent5c5484c8006f3df63d4cfb640f947f6391ea192f (diff)
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).
Diffstat (limited to 'System')
-rw-r--r--System/Posix/Files.hsc3
-rw-r--r--System/Posix/Files/ByteString.hsc3
2 files changed, 4 insertions, 2 deletions
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