On Wed, Mar 27, 2013 at 05:14:24PM +0100, Rafal Mielniczuk wrote: > While running weston with drm-backend, we check if its parent executable > name was weston-launch. In case it wasn't, we print error message and > quit. > > This fixes https://bugs.freedesktop.org/show_bug.cgi?id=60926
Thanks for looking into this. And since we've fixed https://bugs.freedesktop.org/show_bug.cgi?id=60935, now's a good time to do this. However, I think we can use a somewhat simpler approach. If we have a launcher, launcher_sock will be != -1. And it looks like the best way to check for that is just after calling weston_compositor_init() in drm_compositor_create(). Kristian > src/compositor.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/src/compositor.c b/src/compositor.c > index 3e24295..1ad73b2 100644 > --- a/src/compositor.c > +++ b/src/compositor.c > @@ -3491,6 +3491,10 @@ int main(int argc, char *argv[]) > char *socket_name = "wayland-0"; > int32_t version = 0; > char *config_file; > + int ppid; > + FILE *proc_file; > + char proc_name[128]; > + char parent_name[128]; > > const struct config_key core_config_keys[] = { > { "modules", CONFIG_KEY_STRING, &modules }, > @@ -3556,6 +3560,18 @@ int main(int argc, char *argv[]) > backend = WESTON_NATIVE_BACKEND; > } > > + if (!strcmp(backend, WESTON_NATIVE_BACKEND)) { > + ppid = getppid(); > + sprintf(proc_name, "/proc/%d/status", ppid); > + proc_file = fopen(proc_name, "r"); > + fgets(parent_name, 128, proc_file); > + if (!strstr(parent_name, "weston-launch")) { > + weston_log("fatal: drm backend should be run " > + "using weston-launch binary\n"); > + exit(EXIT_FAILURE); > + } > + } > + > config_file = config_file_path("weston.ini"); > parse_config_file(config_file, cs, ARRAY_LENGTH(cs), NULL); > > -- > 1.8.2 > > _______________________________________________ > wayland-devel mailing list > [email protected] > http://lists.freedesktop.org/mailman/listinfo/wayland-devel _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
