[maemo-commits] [maemo-commits] r13722 - in projects/haf/trunk/maemo-launcher: . launcher

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Sep 10 20:12:28 EEST 2007
Author: guillem
Date: 2007-09-10 20:12:24 +0300 (Mon, 10 Sep 2007)
New Revision: 13722

Modified:
   projects/haf/trunk/maemo-launcher/ChangeLog
   projects/haf/trunk/maemo-launcher/launcher/launcher.c
Log:
Properly setup the environment even when not daemonizing

Call umask, chdir and rise_oom_defense in the common execution path.


Modified: projects/haf/trunk/maemo-launcher/ChangeLog
===================================================================
--- projects/haf/trunk/maemo-launcher/ChangeLog	2007-09-10 16:53:08 UTC (rev 13721)
+++ projects/haf/trunk/maemo-launcher/ChangeLog	2007-09-10 17:12:24 UTC (rev 13722)
@@ -1,3 +1,13 @@
+2007-09-10  Guillem Jover  <guillem.jover at nokia.com>
+
+	* launcher/launcher.c (fs_init): New function.
+	(invoked_init): Move umask call to ...
+	(fs_init): ... here.
+	(daemonize): Move chdir call to ...
+	(fs_init): ... here.
+	(invoked_init): Move rise_oom_defense call to ...
+	(main): ... here. Call fs_init after env_init.
+
 2007-08-30  Guillem Jover  <guillem.jover at nokia.com>
 
 	* configure.ac: Version 0.24.

Modified: projects/haf/trunk/maemo-launcher/launcher/launcher.c
===================================================================
--- projects/haf/trunk/maemo-launcher/launcher/launcher.c	2007-09-10 16:53:08 UTC (rev 13721)
+++ projects/haf/trunk/maemo-launcher/launcher/launcher.c	2007-09-10 17:12:24 UTC (rev 13722)
@@ -164,7 +164,6 @@
     die(1, "opening invoker socket\n");
 
   unlink(INVOKER_SOCK);
-  umask(022);
 
   sun.sun_family = AF_UNIX;
   strcpy(sun.sun_path, INVOKER_SOCK);
@@ -626,11 +625,13 @@
     die(1, "forking while daemonizing");
   else if (pid)
     _exit(0);
+}
 
+static void
+fs_init(void)
+{
+  umask(022);
   chdir("/");
-
-  /* Protect us from the oom monster. */
-  rise_oom_defense(getpid());
 }
 
 static void
@@ -730,6 +731,7 @@
 
   sigs_init();
   env_init();
+  fs_init();
 
   /* Setup child tracking. */
   childs = alloc_childs(initial_child_slots);
@@ -740,6 +742,9 @@
   if (daemon)
     daemonize();
 
+  /* Protect us from the oom monster. */
+  rise_oom_defense(getpid());
+
   if (quiet)
     console_quiet();
 


More information about the maemo-commits mailing list