add pledge to xterm

the pledge call is done just before the main loop, so initialisation
is almost done.

- stdio: for all communication on opened fds (read/write/select/recvmsg/...)
- rpath: for X11 error ("X Error of failed request: ...") which read
  at least /usr/X11R6/share/X11/XErrorDB
- wpath : on exit, for opening WR_ONLY "/var/run/utmp"
- cpath : for Tek emulation window (xterm -t)
- id : on exit, for calling setegid()
- proc: on exit, for calling kill()
- tty: on exit, for calling tcflush()

"it is time" deraadt@
This commit is contained in:
semarie 2015-11-07 08:10:24 +00:00
parent 97ddb9c482
commit 9199950164

View File

@ -2598,6 +2598,8 @@ main(int argc, char *argv[]ENVP_ARG)
if (resource.maximized)
RequestMaximize(term, True);
#endif
if (pledge("stdio rpath wpath cpath id proc tty", NULL) == -1)
err(1, "pledge");
for (;;) {
#if OPT_TEK4014
if (TEK4014_ACTIVE(term))