summaryrefslogtreecommitdiff
path: root/Utility/UserInfo.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-06-08 13:48:03 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-06-08 13:48:03 -0400
commit4db8f408e025a58ba272f55c8a8373f68bdcb16b (patch)
tree6b51270a334b3adc03bdc75144d8fba9f2014357 /Utility/UserInfo.hs
parent38da42a980fe460b9e821f4e48b81b639e439406 (diff)
Avoid a crash if getpwuid does not work, when querying the user's full name.
Diffstat (limited to 'Utility/UserInfo.hs')
-rw-r--r--Utility/UserInfo.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/Utility/UserInfo.hs b/Utility/UserInfo.hs
index c6010116e..c2edde24e 100644
--- a/Utility/UserInfo.hs
+++ b/Utility/UserInfo.hs
@@ -15,6 +15,7 @@ module Utility.UserInfo (
) where
import Utility.Env
+import Utility.Exception
import System.PosixCompat
import Control.Applicative
@@ -47,7 +48,7 @@ myUserGecos :: IO (Maybe String)
#if defined(__ANDROID__) || defined(mingw32_HOST_OS)
myUserGecos = return Nothing
#else
-myUserGecos = Just <$> myVal [] userGecos
+myUserGecos = catchMaybeIO $ myVal [] userGecos
#endif
myVal :: [String] -> (UserEntry -> String) -> IO String