diff options
author | 2003-02-28 12:44:54 +0000 | |
---|---|---|
committer | 2003-02-28 12:44:54 +0000 | |
commit | 9b1c00b5f832d6a1edc597dab913dbc287958a0b (patch) | |
tree | e56a783610e2f8e0655dae71254ede1ec30f1785 /System/Posix/Process.hsc | |
parent | bf3d4ea65818fa36926eb0de67dab698bd9a2d17 (diff) |
[project @ 2003-02-28 12:44:54 by stolz]
Fix 'nice': -1 is a permissible return value in a successful situation
Diffstat (limited to 'System/Posix/Process.hsc')
-rw-r--r-- | System/Posix/Process.hsc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/System/Posix/Process.hsc b/System/Posix/Process.hsc index 5549d23..0583063 100644 --- a/System/Posix/Process.hsc +++ b/System/Posix/Process.hsc @@ -71,6 +71,7 @@ import System.IO.Error import System.Exit import System.Posix.Types import System.Posix.Signals +import Monad -- ----------------------------------------------------------------------------- -- Process environment @@ -152,7 +153,12 @@ foreign import ccall unsafe "times" -- Process scheduling priority nice :: Int -> IO () -nice prio = throwErrnoIfMinus1_ "nice" (c_nice (fromIntegral prio)) +nice prio = do + resetErrno + res <- c_nice (fromIntegral prio) + when (res == -1) $ do + err <- getErrno + when (err /= eOK) (throwErrno "nice") foreign import ccall unsafe "nice" c_nice :: CInt -> IO CInt |