Enlightenment CVS committal Author : raster Project : e17 Module : apps/e
Dir : e17/apps/e/src/bin Modified Files: e_main.c e_start_main.c Log Message: force people to do things right and use enlightenment_start =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_main.c,v retrieving revision 1.191 retrieving revision 1.192 diff -u -3 -r1.191 -r1.192 --- e_main.c 17 Oct 2006 12:29:00 -0000 1.191 +++ e_main.c 21 Oct 2006 05:57:27 -0000 1.192 @@ -337,6 +337,18 @@ _e_main_shutdown(-1); } _e_main_shutdown_push(e_alert_shutdown); + + /* we want to have been launched by enlightenment_start. there is a very */ + /* good reason we want to have been launched this way, thus check */ + if (!getenv("E_START")) + { + e_alert_show("You are executing enlightenment directly. This is bad. Please do not execute the\n" + "\"enlightenment\" binary. Use the \"enlightenment_start\" launcher. It will\n" + "handle setting up environment variables, paths, and launching any other required\n" + "services etc. before enlightenment itself begins running.\n"); + exit(-1); + } + if (!e_xinerama_init()) { e_error_message_show(_("Enlightenment cannot setup xinerama wrapping.\n" =================================================================== RCS file: /cvs/e/e17/apps/e/src/bin/e_start_main.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- e_start_main.c 28 Jul 2006 11:36:10 -0000 1.2 +++ e_start_main.c 21 Oct 2006 05:57:27 -0000 1.3 @@ -1,8 +1,11 @@ +#include "config.h" #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> -#include "config.h" +#ifdef HAVE_ALLOCA_H +#include <alloca.h> +#endif static void env_set(const char *var, const char *val); static int prefix_determine(char *argv0); @@ -15,8 +18,9 @@ #ifdef HAVE_SETENV setenv(var, val, 1); #else - char buf[8192]; + char *buf; + buf = alloca(strlen(var) + 1 + strlen(val) + 1); snprintf(buf, sizeof(buf), "%s=%s", var, val); if (getenv(var)) putenv(buf); @@ -248,31 +252,29 @@ main(int argc, char **argv) { int i; - char buf[16384]; - char **args; - char *p; + char buf[16384], **args, *p; prefix_determine(argv[0]); + + env_set("E_START", argv[0]); + p = getenv("PATH"); - if (p) - snprintf(buf, sizeof(buf), "%s/bin:%s", _prefix_path, p); - else - snprintf(buf, sizeof(buf), "%s/bin", _prefix_path); + if (p) snprintf(buf, sizeof(buf), "%s/bin:%s", _prefix_path, p); + else snprintf(buf, sizeof(buf), "%s/bin", _prefix_path); env_set("PATH", buf); p = getenv("LD_LIBRARY_PATH"); - if (p) - snprintf(buf, sizeof(buf), "%s/lib:%s", _prefix_path, p); - else - snprintf(buf, sizeof(buf), "%s/lib", _prefix_path); + if (p) snprintf(buf, sizeof(buf), "%s/lib:%s", _prefix_path, p); + else snprintf(buf, sizeof(buf), "%s/lib", _prefix_path); env_set("LD_LIBRARY_PATH", buf); - args = malloc((argc + 1) * sizeof(char *)); + args = alloca((argc + 1) * sizeof(char *)); args[0] = "enlightenment"; - for (i = 1; i < argc; i++) - args[i] = argv[i]; + for (i = 1; i < argc; i++) args[i] = argv[i]; args[i] = NULL; snprintf(buf, sizeof(buf), "%s/bin/enlightenment", _prefix_path); - return execv(buf, args); + execv(buf, args); + perror("execv"); + return -1; } ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs