summaryrefslogtreecommitdiff
path: root/x11/xterm/patches/patch-main_c
blob: 8c487d1901e9ed311a8909a5010876dc2ec2cbef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
$OpenBSD$

Add pledge()

Index: main.c
--- main.c.orig
+++ main.c
@@ -2880,6 +2880,25 @@ main(int argc, char *argv[]ENVP_ARG)
     if (resource.maximized)
 	RequestMaximize(term, True);
 #endif
+
+    {
+        String data = NULL;
+        getKeymapResources(SHELL_OF(term), "vt100", "VT100", XtRString, &data, sizeof(data));
+        if (data &&
+            (strstr(data, "exec-formatted") || strstr(data, "exec-selectable"))) {
+
+            if (pledge("stdio rpath wpath id proc exec tty", NULL) == -1) {
+                xtermWarning("pledge\n");
+                exit(1);
+            }
+        } else {
+            if (pledge("stdio rpath wpath id proc tty", NULL) == -1) {
+               xtermWarning("pledge\n");
+               exit(1);
+           }
+       }
+    }
+
     for (;;) {
 #if OPT_TEK4014
 	if (TEK4014_ACTIVE(term))