Sync pledge bits-and-pieces from upstream HEAD.

Based on
64bee8acfc,
which reduces number of pledge(2) promises.

OK gonzalo@ (MAINTAINER)
This commit is contained in:
bket 2019-09-26 03:08:34 +00:00
parent 5fd9f980a4
commit 26036f28d7
2 changed files with 9 additions and 11 deletions

View File

@ -1,11 +1,11 @@
# $OpenBSD: Makefile,v 1.29 2019/08/20 15:22:57 bket Exp $
# $OpenBSD: Makefile,v 1.30 2019/09/26 03:08:34 bket Exp $
COMMENT= small tiling window manager
SHARED_LIBS= swmhack 1.0
V= 3.2.0
REVISION= 2
REVISION= 3
GH_TAGNAME= SPECTRWM_${V:S/./_/g}
GH_ACCOUNT= conformal
GH_PROJECT= spectrwm

View File

@ -1,4 +1,4 @@
$OpenBSD: patch-spectrwm_c,v 1.11 2019/07/26 12:04:03 bket Exp $
$OpenBSD: patch-spectrwm_c,v 1.12 2019/09/26 03:08:34 bket Exp $
pledge(2) support based on https://github.com/conformal/spectrwm/pull/217
@ -18,7 +18,7 @@ Index: spectrwm.c
ppwd = strlen(user) == 0 ? getpwuid(getuid()) : getpwnam(user);
free(user);
+ if (pledge("stdio proc exec cpath rpath wpath fattr", NULL) == -1)
+ if (pledge("stdio proc exec rpath", NULL) == -1)
+ err(1, "pledge");
+
if (ppwd == NULL)
@ -34,29 +34,27 @@ Index: spectrwm.c
if (bar_font == NULL)
errx(1, "unable to open a font");
@@ -12469,6 +12475,10 @@ main(int argc, char *argv[])
@@ -12469,6 +12475,9 @@ main(int argc, char *argv[])
if (setlocale(LC_CTYPE, "") == NULL || setlocale(LC_TIME, "") == NULL)
warnx("no locale support");
+ if (pledge("stdio proc exec cpath rpath wpath fattr getpw dns inet "
+ "unix", NULL) == -1)
+ if (pledge("stdio proc exec rpath getpw dns inet unix", NULL) == -1)
+ err(1, "pledge");
+
/* handle some signals */
bzero(&sact, sizeof(sact));
sigemptyset(&sact.sa_mask);
@@ -12486,6 +12496,10 @@ main(int argc, char *argv[])
@@ -12486,6 +12495,9 @@ main(int argc, char *argv[])
if ((display = XOpenDisplay(0)) == NULL)
errx(1, "can not open display");
+ if (pledge("stdio proc exec cpath rpath wpath fattr getpw",
+ NULL) == -1)
+ if (pledge("stdio proc exec rpath getpw", NULL) == -1)
+ err(1, "pledge");
+
conn = XGetXCBConnection(display);
if (xcb_connection_has_error(conn))
errx(1, "can not get XCB connection");
@@ -12673,6 +12687,9 @@ noconfig:
@@ -12673,6 +12685,9 @@ noconfig:
xcb_flush(conn);
}
done: