Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for using pledge() on OpenBSD #21

Merged
merged 1 commit into from Mar 11, 2016
Merged

Add support for using pledge() on OpenBSD #21

merged 1 commit into from Mar 11, 2016

Conversation

fcambus
Copy link
Contributor

@fcambus fcambus commented Mar 10, 2016

This diff adds support for OpenBSD pledge(2).

First time I tweak some autotools related files so I hope I didn't break anything :D I'm not sure if unistd.h should be added to AC_CHECK_HEADERS in configure.ac, and tests without it seems to run fine, however it might be better to have it to be on the safe side?

Tested on OpenBSD, NetBSD and Mac OS X.

@jpmens
Copy link
Owner

jpmens commented Mar 11, 2016

$ uname -a
OpenBSD ot-make-obsd58 5.8 GENERIC#1170 amd64

$ ./configure 
...
checking for unistd.h... yes
...
checking for pledge... no

If I change #if HAVE_PLEDGE to #if 1 in jo.c:

# make
  CCLD     jo
jo.o: In function `main':
/root/jo/jo-0.9/jo.c:368: undefined reference to `pledge'
collect2: ld returned 1 exit status

@jpmens
Copy link
Owner

jpmens commented Mar 11, 2016

There's no pledge(2) page on 5.8, so am I barking up the wrong tree?

@jpmens jpmens merged commit 7ada38c into jpmens:master Mar 11, 2016
@jpmens
Copy link
Owner

jpmens commented Mar 11, 2016

Merged, thank you!

@jpmens
Copy link
Owner

jpmens commented Mar 11, 2016

OpenBSD 5.9

checking for pledge... yes

If I add, say, a call to system("ls"); just after the pledge() call, I get

# ./jo
Abort trap (core dumped)

Very nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants