Enerccio / ewlc

Wayland compositor library - extended
MIT License
20 stars 3 forks source link

Could src/session/tty.c possibly just use current tty? #51

Open WLCIssuesBot opened 7 years ago

WLCIssuesBot commented 7 years ago

Issue by CRBahls Sunday Feb 28, 2016 at 17:10 GMT Originally opened as https://github.com/Cloudef/wlc/issues/130


At the moment (when running on a text console) it tries to find a new one:

int tty0_fd; if ((tty0_fd = open("/dev/tty0", O_RDWR | O_CLOEXEC)) < 0) die("Could not open /dev/tty0 to find free vt");

int vt; if (ioctl(tty0_fd, VT_OPENQRY, &vt) != 0) die("Could not find free vt");

Couldn't it just use the current tty like weston does?

WLCIssuesBot commented 7 years ago

Comment by CRBahls Sunday Feb 28, 2016 at 17:39 GMT


Perhaps i should have made myself a little bit more clear:

just reusing the current tty it doesn't need extra permissions to perform its actions.

usually tty0 is not accessable by a local user.

also a newly created tty will not be usable by the non-root user.

WLCIssuesBot commented 7 years ago

Comment by Cloudef Saturday Mar 05, 2016 at 11:38 GMT


If you can send PR for this, I'm willing to accept it. IIRC the permissions vary between distros, and if you have login manager such as logind that sets XDG_VTNR, it will use that VT (e.g. here it definately uses the current tty)