Enlightenment CVS committal

Author  : kwo
Project : e16
Module  : e

Dir     : e16/e/src


Modified Files:
        actions.c 


Log Message:
Set correct environment when starting remembered applications at startup.

===================================================================
RCS file: /cvs/e/e16/e/src/actions.c,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -3 -r1.209 -r1.210
--- actions.c   10 Sep 2006 18:43:20 -0000      1.209
+++ actions.c   24 Sep 2006 19:07:02 -0000      1.210
@@ -26,6 +26,26 @@
 #include "file.h"
 #include "user.h"
 
+static void
+ExecSetupEnv(int flags)
+{
+   int                 fd;
+
+   setsid();
+
+   /* Close all file descriptors except the std 3 */
+   for (fd = 3; fd < 1024; fd++)
+      close(fd);
+
+   /* Set up env stuff */
+   if (flags & EXEC_SET_LANG)
+      LangExport();
+#if USE_ROOTHACKLIB
+   if (Mode.wm.window)
+      Esetenv("LD_PRELOAD", ENLIGHTENMENT_LIB "/libe16_hack.so");
+#endif
+}
+
 int
 execApplication(const char *params, int flags)
 {
@@ -33,7 +53,6 @@
    char               *sh;
    char               *path;
    char               *real_exec;
-   int                 fd;
 
    if (!params)
       return -1;
@@ -45,18 +64,7 @@
    if (fork())
       return 0;
 
-   setsid();
-   /* Close all file descriptors except the std 3 */
-   for (fd = 3; fd < 1024; fd++)
-      close(fd);
-
-   /* Set up env stuff */
-   if (flags & EXEC_SET_LANG)
-      LangExport();
-#if USE_ROOTHACKLIB
-   if (Mode.wm.window)
-      Esetenv("LD_PRELOAD", ENLIGHTENMENT_LIB "/libe16_hack.so");
-#endif
+   ExecSetupEnv(flags);
 
    sh = usershell(getuid());
 
@@ -159,20 +167,13 @@
 void
 Espawn(int argc __UNUSED__, char **argv)
 {
-   int                 fd;
-
    if (!argv || !argv[0])
       return;
 
    if (fork())
       return;
 
-   setsid();
-   /* Close all file descriptors except the std 3 */
-   for (fd = 3; fd < 1024; fd++)
-      close(fd);
-
-   LangExport();
+   ExecSetupEnv(EXEC_SET_LANG);
 
    execvp(argv[0], argv);
 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to