use pledge by default if compiled on openbsc and provide errno string

This commit is contained in:
Nico Golde 2016-09-06 19:58:28 +02:00
parent a4434536cd
commit 584290f264
2 changed files with 2 additions and 4 deletions

View File

@ -26,5 +26,3 @@ CC = cc
CFLAGS = -g -O0 -W -Wall ${INCLUDES} -DVERSION=\"${VERSION}\"
LDFLAGS = ${LIBS}
# OpenBSD pledge(2) support
# CFLAGS+= -DUSE_PLEDGE

4
ii.c
View File

@ -491,9 +491,9 @@ int main(int argc, char *argv[]) {
}
irc = tcpopen(port);
#ifdef USE_PLEDGE /* OpenBSD pledge(2) support */
#ifdef __OpenBSD__ /* OpenBSD pledge(2) support */
if (pledge("stdio rpath wpath cpath dpath", NULL) == -1) {
fputs("ii: pledge\n", stderr);
eprint("ii pledge:");
exit(EXIT_FAILURE);
}
#endif