Add pledge() to st. Patch by tb@ and semarie@.

OK jung@ (MAINTAINER) gsoares@.
This commit is contained in:
juanfra 2017-04-05 21:29:57 +00:00
parent 2c76e61473
commit 21729ebabc
3 changed files with 27 additions and 5 deletions

View File

@ -1,8 +1,9 @@
# $OpenBSD: Makefile,v 1.13 2016/10/09 18:47:49 czarkoff Exp $
# $OpenBSD: Makefile,v 1.14 2017/04/05 21:29:57 juanfra Exp $
COMMENT= simple X terminal
DISTNAME= st-0.7
REVISION= 0
CATEGORIES= x11
@ -13,6 +14,7 @@ MAINTAINER= Joerg Jung <jung@openbsd.org>
# MIT/X Consortium License
PERMIT_PACKAGE_CDROM= Yes
# uses pledge()
WANTLIB= c m util X11 Xft fontconfig freetype z
MASTER_SITES= http://dl.suckless.org/st/

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-config_mk,v 1.8 2016/10/09 18:47:49 czarkoff Exp $
--- config.mk.orig Sat Oct 8 21:48:48 2016
+++ config.mk Sat Oct 8 21:50:30 2016
$OpenBSD: patch-config_mk,v 1.9 2017/04/05 21:29:57 juanfra Exp $
--- config.mk.orig Thu Aug 11 16:25:58 2016
+++ config.mk Tue Mar 28 12:27:10 2017
@@ -4,24 +4,21 @@ VERSION = 0.7
# Customize below to fit your system
@ -27,9 +27,10 @@ $OpenBSD: patch-config_mk,v 1.8 2016/10/09 18:47:49 czarkoff Exp $
+LIBS +!= pkg-config --libs fontconfig
# flags
CPPFLAGS = -DVERSION=\"${VERSION}\" -D_XOPEN_SOURCE=600
-CPPFLAGS = -DVERSION=\"${VERSION}\" -D_XOPEN_SOURCE=600
-CFLAGS += -g -std=c99 -pedantic -Wall -Wvariadic-macros -Os ${INCS} ${CPPFLAGS}
-LDFLAGS += -g ${LIBS}
+CPPFLAGS = -DVERSION=\"${VERSION}\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
+CFLAGS += -std=c99 ${INCS} ${CPPFLAGS}
+LDFLAGS += ${LIBS}

19
x11/st/patches/patch-st_c Normal file
View File

@ -0,0 +1,19 @@
$OpenBSD: patch-st_c,v 1.3 2017/04/05 21:29:57 juanfra Exp $
--- st.c.orig Thu Aug 11 16:25:58 2016
+++ st.c Wed Mar 29 14:20:44 2017
@@ -1454,9 +1454,15 @@ ttynew(void)
die("ioctl TIOCSCTTY failed: %s\n", strerror(errno));
close(s);
close(m);
+
+ if (pledge("stdio getpw proc exec", NULL) == -1)
+ die("pledge\n");
+
execsh();
break;
default:
+ if (pledge("stdio rpath tty", NULL) == -1)
+ die("pledge\n");
close(s);
cmdfd = m;
signal(SIGCHLD, sigchld);