[PATCH weston 2/2] weston-launch: Only clear the environment of the child process
Ander Conselvan de Oliveira
ander.conselvan.de.oliveira at intel.com
Tue Jun 4 06:43:43 PDT 2013
In order for the systemd notification to succeed, sd_notify() needs the
value of the NOTIFY_SOCKET environment variable, but the environment was
cleared before entering the launcher's main loop.
Work around this by only clearing the environment of the child process.
---
src/weston-launch.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/weston-launch.c b/src/weston-launch.c
index f93fe01..5de6d33 100644
--- a/src/weston-launch.c
+++ b/src/weston-launch.c
@@ -608,14 +608,6 @@ main(int argc, char *argv[])
child_argv[5 + i] = argv[optind + i];
child_argv[5 + i] = NULL;
- term = getenv("TERM");
- clearenv();
- setenv("TERM", term, 1);
- setenv("USER", wl.pw->pw_name, 1);
- setenv("LOGNAME", wl.pw->pw_name, 1);
- setenv("HOME", wl.pw->pw_dir, 1);
- setenv("SHELL", wl.pw->pw_shell, 1);
-
if (!weston_launch_allowed(&wl))
error(1, 0, "Permission denied. You should either:\n"
#ifdef HAVE_SYSTEMD_LOGIN
@@ -646,6 +638,14 @@ main(int argc, char *argv[])
error(1, errno, "fork failed");
break;
case 0:
+ term = getenv("TERM");
+ clearenv();
+ setenv("TERM", term, 1);
+ setenv("USER", wl.pw->pw_name, 1);
+ setenv("LOGNAME", wl.pw->pw_name, 1);
+ setenv("HOME", wl.pw->pw_dir, 1);
+ setenv("SHELL", wl.pw->pw_shell, 1);
+
if (wl.verbose)
printf("weston-launch: spawned weston with pid: %d\n", getpid());
if (wl.tty != STDIN_FILENO) {
--
1.7.10.4
More information about the wayland-devel
mailing list