summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNico Golde <nico@ngolde.de>2016-09-02 16:13:43 +0200
committerNico Golde <nico@ngolde.de>2016-09-02 16:13:43 +0200
commit18580a159febc9c9658d82d73b90b53895c1ec00 (patch)
tree83e85e5e07796110ba4bfd29e4eca2be818d9780
parentf79e2f09534d92a6fe4e062b06449a925fef1c41 (diff)
downloadii-18580a159febc9c9658d82d73b90b53895c1ec00.zip
ii-18580a159febc9c9658d82d73b90b53895c1ec00.tar.gz
ii-18580a159febc9c9658d82d73b90b53895c1ec00.tar.bz2
add OpenBSD pledge support - thanks Gleydson Soares
-rw-r--r--config.mk3
-rw-r--r--ii.c8
2 files changed, 11 insertions, 0 deletions
diff --git a/config.mk b/config.mk
index afc28d5..2cf103e 100644
--- a/config.mk
+++ b/config.mk
@@ -25,3 +25,6 @@ LIBS = -L${LIBDIR} -L/usr/lib -lc
CC = cc
CFLAGS = -g -O0 -W -Wall ${INCLUDES} -DVERSION=\"${VERSION}\"
LDFLAGS = ${LIBS}
+
+# OpenBSD pledge(2) support
+# CFLAGS+= -DUSE_PLEDGE
diff --git a/ii.c b/ii.c
index 745e29a..19f1b4c 100644
--- a/ii.c
+++ b/ii.c
@@ -490,6 +490,14 @@ int main(int argc, char *argv[]) {
}
}
irc = tcpopen(port);
+
+ #ifdef USE_PLEDGE /* OpenBSD pledge(2) support */
+ if (pledge("stdio rpath wpath cpath dpath", NULL) == -1) {
+ fputs("ii: pledge\\n", stderr);
+ exit(EXIT_FAILURE);
+ }
+ #endif
+
if(!snprintf(path, sizeof(path), "%s/%s", prefix, host)) {
fputs("ii: path to irc directory too long\n", stderr);
exit(EXIT_FAILURE);