From 3fe82a9c30a4c9b461eb494601e621f2d69519dc Mon Sep 17 00:00:00 2001 From: sof Date: Fri, 14 Aug 1998 13:09:01 +0000 Subject: [PATCH] [project @ 1998-08-14 13:09:00 by sof] More error message updates --- ghc/lib/posix/PosixProcEnv.lhs | 17 +++++++++++++---- ghc/lib/posix/PosixProcPrim.lhs | 4 ++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/ghc/lib/posix/PosixProcEnv.lhs b/ghc/lib/posix/PosixProcEnv.lhs index cd757e7..c2f0b0f 100644 --- a/ghc/lib/posix/PosixProcEnv.lhs +++ b/ghc/lib/posix/PosixProcEnv.lhs @@ -111,10 +111,18 @@ getGroups = do getEffectiveUserName :: IO String getEffectiveUserName = do + {- cuserid() is deprecated, using getpwuid() instead. -} + euid <- getEffectiveUserID + ptr <- _ccall_ getpwuid euid + str <- _casm_ ``%r = ((struct passwd *)%0)->pw_name;'' (ptr::Addr) + strcpy str + +{- OLD: str <- _ccall_ cuserid (``NULL''::Addr) if str == ``NULL'' then syserr "getEffectiveUserName" else strcpy str +-} getProcessGroupID :: IO ProcessGroupID getProcessGroupID = _ccall_ getpgrp @@ -222,7 +230,7 @@ getControllingTerminalName :: IO FilePath getControllingTerminalName = do str <- _ccall_ ctermid (``NULL''::Addr) if str == ``NULL'' - then fail (IOError Nothing NoSuchThing "getControllingTerminalName: no controlling terminal") + then fail (IOError Nothing NoSuchThing "getControllingTerminalName" "no controlling terminal") else strcpy str #endif @@ -234,9 +242,9 @@ getTerminalName fd = do err <- try (queryTerminal fd) either (\err -> syserr "getTerminalName") (\succ -> if succ then fail (IOError Nothing NoSuchThing - "getTerminalName: no name") + "getTerminalName" "no name") else fail (IOError Nothing InappropriateType - "getTerminalName: not a terminal")) + "getTerminalName" "not a terminal")) err else strcpy str @@ -276,6 +284,7 @@ sysconf n = do if rc /= -1 then return rc else fail (IOError Nothing NoSuchThing - "getSysVar: no such system limit or option") + "getSysVar" + "no such system limit or option") \end{code} diff --git a/ghc/lib/posix/PosixProcPrim.lhs b/ghc/lib/posix/PosixProcPrim.lhs index ab3a40a..2450a9e 100644 --- a/ghc/lib/posix/PosixProcPrim.lhs +++ b/ghc/lib/posix/PosixProcPrim.lhs @@ -212,7 +212,7 @@ getEnvVar name = do str <- _ccall_ getenv str if str == ``NULL'' then fail (IOError Nothing NoSuchThing - "getEnvVar: no such environment variable") + "getEnvVar" "no such environment variable") else strcpy str setEnvVar :: String -> String -> IO () @@ -378,7 +378,7 @@ installHandler :: Signal -> IO Handler -- old handler #ifdef __PARALLEL_HASKELL__ -installHandler = error "installHandler: not available for Parallel Haskell" +installHandler = fail (userError "installHandler: not available for Parallel Haskell") #else installHandler int handler maybe_mask = ( case handler of -- 1.7.10.4