[PATCH weston 1/8] weston-launcher: use CLOEXEC on fallback path

Pekka Paalanen ppaalanen at gmail.com
Tue Jul 31 03:21:06 PDT 2012


If there is no weston-launcher available, launcher-util.c will fall back
to opening the given file itself. It that case it does not set the
close-on-exec flag, and will presumably leak the file descriptor to
children.

Use O_CLOEXEC on the fallback path, too.

Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
 src/launcher-util.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/launcher-util.c b/src/launcher-util.c
index ad03c1d..b4b82f1 100644
--- a/src/launcher-util.c
+++ b/src/launcher-util.c
@@ -54,7 +54,7 @@ weston_launcher_open(struct weston_compositor *compositor,
 	struct weston_launcher_open *message;
 
 	if (sock == -1)
-		return open(path, flags);
+		return open(path, flags | O_CLOEXEC);
 
 	n = sizeof(*message) + strlen(path) + 1;
 	message = malloc(n);
-- 
1.7.8.6



More information about the wayland-devel mailing list