From cfdb91cd85a286630458327358142a1160a9053e Mon Sep 17 00:00:00 2001 From: Sebastien Marie Date: Wed, 25 Nov 2015 08:56:51 +0000 Subject: 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. --- app/xterm/main.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'app') 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 (;;) { -- cgit v1.2.3