mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-10-15 16:43:57 +00:00
shell: Skip clients that we forked ourselves in kill binding
When we fork a client and give one end of a socketpair, the credentials on the socket fd comes back as ourselves. When that happens, do not kill the process. Also remove superfluous variables. Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
This commit is contained in:
parent
b7dbbd6fc7
commit
920f1970a4
|
@ -3506,15 +3506,18 @@ force_kill_binding(struct wl_seat *seat, uint32_t time, uint32_t key,
|
||||||
struct wl_surface *focus_surface;
|
struct wl_surface *focus_surface;
|
||||||
struct wl_client *client;
|
struct wl_client *client;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
uid_t uid;
|
|
||||||
gid_t gid;
|
|
||||||
|
|
||||||
focus_surface = seat->keyboard->focus;
|
focus_surface = seat->keyboard->focus;
|
||||||
if (!focus_surface)
|
if (!focus_surface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
client = focus_surface->resource.client;
|
client = focus_surface->resource.client;
|
||||||
wl_client_get_credentials(client, &pid, &uid, &gid);
|
wl_client_get_credentials(client, &pid, NULL, NULL);
|
||||||
|
|
||||||
|
/* Skip clients that we launched ourselves (the credentials of
|
||||||
|
* the socketpair is ours) */
|
||||||
|
if (pid == getpid())
|
||||||
|
return;
|
||||||
|
|
||||||
kill(pid, SIGKILL);
|
kill(pid, SIGKILL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue