bd1a72b0f5b7d41efbfe31152152cf35454511a7
[AGL/meta-agl.git] / meta-agl-profile-graphical / recipes-graphics / wayland / weston / 0001-Allow-regular-users-to-launch-Weston_2.0.0.patch
1 From 6c145cea35f0b77613d6e3f48679c976b9839d7c Mon Sep 17 00:00:00 2001
2 From: Ronan Le Martret <ronan.lemartret@iot.bzh>
3 Date: Wed, 31 May 2017 22:48:18 +0000
4 Subject: [PATCH] Allow regular users to launch Weston
5
6 Signed-off-by: Ronan Le Martret <ronan.lemartret@iot.bzh>
7 ---
8  configure.ac                | 6 ++++++
9  libweston/launcher-direct.c | 2 ++
10  2 files changed, 8 insertions(+)
11
12 diff --git a/configure.ac b/configure.ac
13 index 7e84c14..8b3e17e 100644
14 --- a/configure.ac
15 +++ b/configure.ac
16 @@ -155,6 +155,12 @@ if test x$enable_xkbcommon = xyes; then
17                            true)
18  fi
19  
20 +AC_ARG_ENABLE(sys-uid, [  --enable-sys-uid],,
21 +              enable_sys_uid=no)
22 +if test x$enable_sys_uid = xyes; then
23 +       AC_DEFINE(ENABLE_SYS_UID, [1], [Allow regular users to launch Weston])
24 +fi
25 +
26  AC_ARG_ENABLE(setuid-install, [  --enable-setuid-install],,
27               enable_setuid_install=yes)
28  AM_CONDITIONAL(ENABLE_SETUID_INSTALL, test x$enable_setuid_install = xyes)
29 diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c
30 index 4fc1c3c..8f16a69 100644
31 --- a/libweston/launcher-direct.c
32 +++ b/libweston/launcher-direct.c
33 @@ -275,8 +275,10 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor *
34  {
35         struct launcher_direct *launcher;
36  
37 +#ifndef ENABLE_SYS_UID
38         if (geteuid() != 0)
39                 return -EINVAL;
40 +#endif
41  
42         launcher = zalloc(sizeof(*launcher));
43         if (launcher == NULL)
44 -- 
45 2.7.4
46