packages feed

hdaemonize 0.5.4 → 0.5.5

raw patch · 3 files changed

+29/−8 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

README.md view
@@ -68,6 +68,9 @@ Changelog --------- +* 0.5.4+    * Update to use hsyslog == 5.+ * 0.5.2     * Fix pre-AMP builds. 
System/Posix/Daemonize.hs view
@@ -15,6 +15,7 @@    http://sneakymustard.com/2008/12/11/haskell-daemons -}  +import Control.Applicative(pure) import Control.Monad (when) import Control.Monad.Trans import Control.Exception.Extensible@@ -33,6 +34,9 @@ import Data.ByteString (ByteString) import qualified Data.ByteString.Char8 as ByteString import Data.ByteString.Unsafe (unsafeUseAsCStringLen)++import Data.Foldable (asum)+ import Data.Maybe (isNothing, fromMaybe, fromJust) import System.Environment import System.Exit@@ -296,12 +300,26 @@  dropPrivileges :: CreateDaemon a -> IO () dropPrivileges daemon =-    do Just ud <- getUserID "daemon"-       Just gd <- getGroupID "daemon"-       let targetUser = fromMaybe (fromJust $ name daemon) (user daemon)-           targetGroup = fromMaybe (fromJust $ name daemon) (group daemon)-       u <- fromMaybe ud <$> getUserID targetUser-       g <- fromMaybe gd <$> getGroupID targetGroup+    do let targetUser = fromJust $ asum [ user daemon+                                        , name daemon+                                        , Just "daemon"+                                        ]+           targetGroup = fromJust $ asum [ group daemon+                                         , name daemon+                                         , Just "daemon"+                                         ]+       mud <- getUserID targetUser+       mgd <- getGroupID targetGroup+       u <- case mud of+           Nothing -> do syslog Error "Privilege drop failure, no suitable user."+                         exitImmediately (ExitFailure 1)+                         undefined+           Just ud -> pure ud+       g <- case mgd of+           Nothing -> do syslog Error "Privilege drop failure, no suitable group."+                         exitImmediately (ExitFailure 1)+                         undefined+           Just gd -> pure gd        setGroupID g        setUserID u 
hdaemonize.cabal view
@@ -1,5 +1,5 @@ Name:		hdaemonize-Version:	0.5.4+Version:	0.5.5 Cabal-Version:  >= 1.6 License:	BSD3 License-file:   LICENSE@@ -15,7 +15,7 @@ 		command line handling, dropping privileges). Build-Type:	Simple Extra-Source-Files:	README.md-Tested-With: GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1, GHC == 8.0.2+Tested-With: GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.2  Library   Build-Depends:    base >= 4 && < 5