File ivman-0.6.14-daemonize_early.patch of Package ivman
Index: ivman-0.6.14/src/manager.c
===================================================================
--- ivman-0.6.14.orig/src/manager.c
+++ ivman-0.6.14/src/manager.c
@@ -1424,6 +1424,16 @@ int main(int argc, char *argv[])
parseArguments(argc, argv);
do_startup_configure();
+ if ( cfg_base->fork ) {
+ // Daemonize
+ isdaemon = daemonize();
+
+ if ( !isdaemon ) {
+ DEBUG(_("Couldn't daemonize, exiting..."));
+ return 1;
+ }
+ }
+
if (!g_thread_supported ())
g_thread_init (NULL);
dbus_g_thread_init ();
@@ -1458,16 +1468,6 @@ int main(int argc, char *argv[])
}
- if ( cfg_base->fork ) {
- // Daemonize
- isdaemon = daemonize();
-
- if ( !isdaemon ) {
- DEBUG(_("Couldn't daemonize, exiting..."));
- return 1;
- }
- }
-
// Drop privileges. Must do this _after_ daemonizing!
if ((geteuid() == 0) && (!dropPrivileges(cfg_base->user, cfg_base->group)))
{