Revision 29a30533 htools/Ganeti/Daemon.hs

b/htools/Ganeti/Daemon.hs
344 344
                         syslogUsageFromRaw C.syslogUsage
345 345
              Just v -> return v
346 346

  
347
  log_file <- daemonLogFile daemon
347 348
  -- run the check function and optionally exit if it returns an exit code
348 349
  check_result <- check_fn opts
349 350
  check_result' <- case check_result of
......
351 352
                     Right v -> return v
352 353

  
353 354
  let processFn = if optDaemonize opts
354
                    then daemonize (daemonLogFile daemon)
355
                    then daemonize log_file
355 356
                    else \action -> action Nothing
356 357
  processFn $ innerMain daemon opts syslog check_result' prep_fn exec_fn
357 358

  
......
367 368
         -> PrepFn a b    -- ^ Prepare function
368 369
         -> IO b
369 370
fullPrep daemon opts syslog check_result prep_fn = do
370
  let logfile = if optDaemonize opts
371
                  then Nothing
372
                  else Just $ daemonLogFile daemon
373
      pidfile = daemonPidFile daemon
374
      dname = daemonName daemon
371
  logfile <- if optDaemonize opts
372
               then return Nothing
373
               else liftM Just $ daemonLogFile daemon
374
  pidfile <- daemonPidFile daemon
375
  let dname = daemonName daemon
375 376
  setupLogging logfile dname (optDebug opts) True False syslog
376 377
  _ <- describeError "writing PID file; already locked?"
377 378
         Nothing (Just pidfile) $ writePidFile pidfile

Also available in: Unified diff