summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-08 14:18:02 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-08 14:18:02 -0400
commite0cd9776690c74aa1b346aa11615a75c862d7714 (patch)
tree6affe1bb4eaaddfcb503e8e3cbeb1a413f67d95a
parent96950a3b40e462abf607377d509ebf14c7d4a1a1 (diff)
make pid file directory
-rw-r--r--Utility/Daemon.hs1
1 files changed, 1 insertions, 0 deletions
diff --git a/Utility/Daemon.hs b/Utility/Daemon.hs
index ba2b2c9c3..35b485983 100644
--- a/Utility/Daemon.hs
+++ b/Utility/Daemon.hs
@@ -46,6 +46,7 @@ daemonize logfd pidfile changedirectory a = do
- Fails if the pid file is already locked by another process. -}
lockPidFile :: FilePath -> IO ()
lockPidFile file = do
+ createDirectoryIfMissing True (parentDir file)
fd <- openFd file ReadWrite (Just stdFileMode) defaultFileFlags
locked <- catchMaybeIO $ setLock fd (WriteLock, AbsoluteSeek, 0, 0)
fd' <- openFd newfile ReadWrite (Just stdFileMode) defaultFileFlags