summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastien Marie <semarie@cvs.openbsd.org>2015-11-25 08:56:51 +0000
committerSebastien Marie <semarie@cvs.openbsd.org>2015-11-25 08:56:51 +0000
commitcfdb91cd85a286630458327358142a1160a9053e (patch)
treec62afc3684ae74b71c2541f84fab5a6922f98b13
parentae38e24855fd5353ecb05cb80da06e2954db9f88 (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.
-rw-r--r--app/xterm/main.c19
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 (;;) {