launcher-direct: warn when opening devices non-root

Warn the user that this is not supposed to work. Developers who know
what they are doing know to ignore this message, others should think
twice.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
This commit is contained in:
Pekka Paalanen 2020-09-09 17:20:13 +03:00 committed by Pekka Paalanen
parent 4e9f4d0474
commit 2d738b856d
1 changed files with 6 additions and 0 deletions

View File

@ -232,6 +232,12 @@ launcher_direct_open(struct weston_launcher *launcher_base, const char *path, in
if (fd == -1)
return -1;
if (geteuid() != 0) {
weston_log("WARNING! Succeeded opening %s as non-root user."
" This implies your device can be spied on.\n",
path);
}
if (fstat(fd, &s) == -1) {
close(fd);
return -1;