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

OpenBSD: use pledge(2) #112

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

OpenBSD: use pledge(2) #112

wants to merge 2 commits into from

Conversation

klemensn
Copy link

  • OpenBSD: Define _BSD_SOURCE to get pledge(2)
  • OpenBSD: use pledge(2)

The unconditional define of _POSIX_C_SOURCE in pigz 2.5
(bf19597 "Add MinGW large file support."), later changed to
_XOPEN_SOURCE in pigz 2.6 (c9de6c5 "Portability improvements."),
causes <sys/cdefs.h> to define __POSIX_VISIBLE and, because _BSD_SOURCE
undefined, to also define __BSD_VISIBLE as 0, preventing <unistd.h>
from prototyping pledge(2).
Start with "stdio rpath wpath cpath fattr chown" like OpenBSD's gzip(1).

For `g.pipeout' aka. -c and `g.decode == 2' aka. -t, drop to
"stdio rpath", like gzip;  a previous path retained "cpath" for signal
handler to unlink(2) output files, but this is not needed as -c and -t
never open any file for output/writing.

Do the same for `g.list' aka. -l.

OpenBSD's port started using broader pledge in 2018 and refined promises
to match gzip in january 2023.

https://man.openbsd.org/pledge.2
https://man.openbsd.org/gzip.1
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.

1 participant