summaryrefslogtreecommitdiff
path: root/app/xterm
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2021-09-06 11:15:26 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2021-09-06 11:15:26 +0000
commitd2304921fa559cbe22e94700caeed9d28ef093e5 (patch)
tree424c399a7918f6b95ac0430f00b96b7240ada8c9 /app/xterm
parentba4ae4ba868d0904d05c6c41f91f863395e76953 (diff)
Don't exit if unveil() fails. ok deraadt@
Diffstat (limited to 'app/xterm')
-rw-r--r--app/xterm/main.c61
1 files changed, 17 insertions, 44 deletions
diff --git a/app/xterm/main.c b/app/xterm/main.c
index ceede6f31..c74ca0286 100644
--- a/app/xterm/main.c
+++ b/app/xterm/main.c
@@ -2908,71 +2908,44 @@ main(int argc, char *argv[]ENVP_ARG)
char *env;
if ((env = getenv("HOME"))) {
char homefile[PATH_MAX];
-
+ /* we ignore unveil() errors - they are no relevant here */
snprintf(homefile, sizeof homefile, "%s/.fonts", env);
- if (unveil(homefile, "r") == -1) {
- xtermWarning("unveil\n");
- exit(1);
- }
+ unveil(homefile, "r");
snprintf(homefile, sizeof homefile, "%s/.cache/fontconfig",
env);
- if (unveil(homefile, "r") == -1) {
- xtermWarning("unveil\n");
- exit(1);
- }
+ unveil(homefile, "r");
snprintf(homefile, sizeof homefile, "%s/.icons", env);
- if (unveil(homefile, "r") == -1) {
- xtermWarning("unveil\n");
- exit(1);
- }
+ unveil(homefile, "r");
}
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);
- }
+ unveil(xdgfile, "r");
snprintf(xdgfile, sizeof xdgfile, "%s/icons", env);
- if (unveil(xdgfile, "r") == -1) {
- xtermWarning("unveil\n");
- exit(1);
- }
+ unveil(xdgfile, "r");
}
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);
- }
+ unveil(xdgfile, "r");
snprintf(xdgfile, sizeof xdgfile, "%s/icons", env);
- if (unveil(xdgfile, "r") == -1) {
- xtermWarning("unveil\n");
- exit(1);
- }
+ unveil(xdgfile, "r");
}
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);
- }
+ unveil(xdgfile, "r");
+ }
+ unveil("/usr/X11R6", "r");
+ unveil("/usr/local/share/fonts", "r");
+ unveil("/var/cache/fontconfig", "r");
+ unveil("/usr/local/share/icons", "r");
+ unveil("/usr/local/lib/X11/icons", "r");
+ unveil(etc_utmp, "w");
+ unveil(etc_wtmp, "w");
if (pledge("stdio rpath wpath id proc tty", NULL) == -1) {
xtermWarning("pledge\n");