There are numerous issues. I have two cases of pledge calls in one program:

First the program should require stdio,proc,exec (I fork(), execl(), open
and close file descriptors using fdopen() and used dup2()) and use
functionality to call fopen("/etc/pkg.conf", "w"); as a normal user or root
user without it crashing.


In the first case, I merely call pledge("stdio,proc", NULL); at the
beginning of main() and it works.

In the second case, I also add pledge("stdio", NULL); after the parts with
the fork() and execl() calls have been completed and it crashes on the
fopen("/etc/pkg.conf", "w"); call whether I'm the normal user or I'm root.

-Luke

Reply via email to