add pledge promise "exec" for few cases in xterm

in particular if the user use `exec-formatted' or `exec-selectable' actions in key binding.

problem reported by jirib at devio dot us.
This commit is contained in:
semarie 2015-11-25 08:56:50 +00:00
parent 90e9a7268a
commit d0c47f20a0

View File

@ -2599,9 +2599,22 @@ main(int argc, char *argv[]ENVP_ARG)
RequestMaximize(term, True);
#endif
if (pledge("stdio rpath wpath cpath id proc tty", NULL) == -1) {
xtermWarning("pledge\n");
exit(1);
{
String data = NULL;
getKeymapResources(term, "vt100", "VT100", XtRString, &data, sizeof(data));
if (data &&
(strstr(data, "exec-formatted") || strstr(data, "exec-selectable"))) {
if (pledge("stdio rpath wpath cpath id proc exec tty", NULL) == -1) {
xtermWarning("pledge\n");
exit(1);
}
} else {
if (pledge("stdio rpath wpath cpath id proc tty", NULL) == -1) {
xtermWarning("pledge\n");
exit(1);
}
}
}
for (;;) {