diff options
author | Hiltjo Posthuma | 2018-05-25 11:59:28 +0200 |
---|---|---|
committer | Hiltjo Posthuma | 2018-05-25 11:59:28 +0200 |
commit | 66a5360c00901b33482c1f506ebb06aba38494a9 (patch) | |
tree | 4f5e57fe6c42e6fb83d90dccf5a79577252c081e | |
parent | 06d55e474b12c35c36e86fcc3dca6399ddde9996 (diff) | |
download | aur-66a5360c00901b33482c1f506ebb06aba38494a9.tar.gz |
Pledge on OpenBSD
-rw-r--r-- | config.mk | 6 | ||||
-rw-r--r-- | st.c | 8 |
2 files changed, 14 insertions, 0 deletions
diff --git a/config.mk b/config.mk index 039c42cef089..c7355f1507c8 100644 --- a/config.mk +++ b/config.mk @@ -23,6 +23,12 @@ CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 STCFLAGS = $(INCS) $(CPPFLAGS) $(CFLAGS) STLDFLAGS = $(LIBS) $(LDFLAGS) +# OpenBSD: +#CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE +#LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \ +# `pkg-config --libs fontconfig` \ +# `pkg-config --libs freetype2` + # compiler and linker # CC = c99 @@ -28,6 +28,10 @@ #include <libutil.h> #endif +#ifndef __OpenBSD__ +#define pledge(a,b) 0 +#endif + /* Arbitrary sizes */ #define UTF_INVALID 0xFFFD #define UTF_SIZ 4 @@ -806,9 +810,13 @@ ttynew(char *line, char *cmd, char *out, char **args) die("ioctl TIOCSCTTY failed: %s\n", strerror(errno)); close(s); close(m); + if (pledge("stdio getpw proc exec", NULL) == -1) + die("pledge\n"); execsh(cmd, args); break; default: + if (pledge("stdio rpath tty proc", NULL) == -1) + die("pledge\n"); close(s); cmdfd = m; signal(SIGCHLD, sigchld); |