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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
$OpenBSD$
Add pledge() and unveil()
Index: main.c
--- main.c.orig
+++ main.c
@@ -2893,6 +2893,94 @@ 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 {
+ char *env;
+ if ((env = getenv("HOME"))) {
+ char homefile[PATH_MAX];
+
+ snprintf(homefile, sizeof homefile, "%s/.fonts", env);
+ if (unveil(homefile, "r") == -1) {
+ xtermWarning("unveil\n");
+ exit(1);
+ }
+ snprintf(homefile, sizeof homefile, "%s/.cache/fontconfig",
+ env);
+ if (unveil(homefile, "r") == -1) {
+ xtermWarning("unveil\n");
+ exit(1);
+ }
+ snprintf(homefile, sizeof homefile, "%s/.icons", env);
+ if (unveil(homefile, "r") == -1) {
+ xtermWarning("unveil\n");
+ exit(1);
+ }
+ }
+ if ((env = getenv("XDG_CONFIG_HOME"))) {
+ char xdgfile[PATH_MAX];
+
+ snprintf(xdgfile, sizeof xdgfile, "%s/fontconfig", env);
+ if (unveil(xdgfile, "r") == -1) {
+ xtermWarning("unveil\n");
+ exit(1);
+ }
+ snprintf(xdgfile, sizeof xdgfile, "%s/icons", env);
+ if (unveil(xdgfile, "r") == -1) {
+ xtermWarning("unveil\n");
+ exit(1);
+ }
+ }
+ if ((env = getenv("XDG_DATA_HOME"))) {
+ char xdgfile[PATH_MAX];
+
+ snprintf(xdgfile, sizeof xdgfile, "%s/fontconfig", env);
+ if (unveil(xdgfile, "r") == -1) {
+ xtermWarning("unveil\n");
+ exit(1);
+ }
+ snprintf(xdgfile, sizeof xdgfile, "%s/icons", env);
+ if (unveil(xdgfile, "r") == -1) {
+ xtermWarning("unveil\n");
+ exit(1);
+ }
+ }
+ if ((env = getenv("XDG_CACHE_HOME"))) {
+ char xdgfile[PATH_MAX];
+
+ snprintf(xdgfile, sizeof xdgfile, "%s/fontconfig", env);
+ if (unveil(xdgfile, "r") == -1) {
+ xtermWarning("unveil\n");
+ exit(1);
+ }
+ }
+ if ((unveil("/usr/X11R6", "r") == -1) ||
+ (unveil("/usr/local/share/fonts", "r") == -1) ||
+ (unveil("/var/cache/fontconfig", "r") == -1) ||
+ (unveil("/usr/local/share/icons", "r") == -1) ||
+ (unveil("/usr/local/lib/X11/icons", "r") == -1) ||
+ (unveil(etc_utmp, "w") == -1) ||
+ (unveil(etc_wtmp, "w") == -1)) {
+ xtermWarning("unveil\n");
+ exit(1);
+ }
+
+ if (pledge("stdio rpath wpath id proc tty", NULL) == -1) {
+ xtermWarning("pledge\n");
+ exit(1);
+ }
+ }
+ }
+
for (;;) {
#if OPT_TEK4014
if (TEK4014_ACTIVE(term))
|