summaryrefslogtreecommitdiff
path: root/Touch.hsc
diff options
context:
space:
mode:
Diffstat (limited to 'Touch.hsc')
-rw-r--r--Touch.hsc5
1 files changed, 2 insertions, 3 deletions
diff --git a/Touch.hsc b/Touch.hsc
index 4f26855d2..dd0c38984 100644
--- a/Touch.hsc
+++ b/Touch.hsc
@@ -15,6 +15,7 @@ module Touch (
import Foreign
import Foreign.C
+import Control.Monad (when)
newtype TimeSpec = TimeSpec CTime
@@ -66,9 +67,7 @@ touchBoth file atime mtime follow =
withCString file $ \f -> do
pokeArray ptr [atime, mtime]
r <- c_utimensat at_fdcwd f ptr flags
- if (r /= 0)
- then throwErrno "touchBoth"
- else return ()
+ when (r /= 0) $ throwErrno "touchBoth"
where
flags = if follow
then 0