avoid trying to use GECOS on Android, which responds with sig11

This commit is contained in:
Joey Hess 2013-02-19 18:06:27 -04:00
parent 56e56d98c7
commit e1dba0c3dc

View file

@ -5,6 +5,8 @@
- Licensed under the GNU GPL version 3 or higher.
-}
{-# LANGUAGE CPP #-}
module Utility.UserInfo (
myHomeDir,
myUserName,
@ -26,7 +28,11 @@ myUserName :: IO String
myUserName = myVal ["USER", "LOGNAME"] userName
myUserGecos :: IO String
#ifdef WITH_ANDROID
myUserGecos = return "" -- userGecos crashes on Android
#else
myUserGecos = myVal [] userGecos
#endif
myVal :: [String] -> (UserEntry -> String) -> IO String
myVal envvars extract = maybe (extract <$> getpwent) return =<< check envvars