diff options
author | Sebastien Marie <semarie@cvs.openbsd.org> | 2015-11-25 08:56:51 +0000 |
---|---|---|
committer | Sebastien Marie <semarie@cvs.openbsd.org> | 2015-11-25 08:56:51 +0000 |
commit | cfdb91cd85a286630458327358142a1160a9053e (patch) | |
tree | c62afc3684ae74b71c2541f84fab5a6922f98b13 /app | |
parent | ae38e24855fd5353ecb05cb80da06e2954db9f88 (diff) |
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.
Diffstat (limited to 'app')
-rw-r--r-- | app/xterm/main.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/app/xterm/main.c b/app/xterm/main.c index 3601813d7..5fa530644 100644 --- a/app/xterm/main.c +++ b/app/xterm/main.c @@ -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 (;;) { |