pidfile_remove() uses unlink() to remove the pidfile, so it will always fail when called in capability mode. It would be nice if the pidfile code used Capsicum-friendly syscalls instead. pidfile_open() could keep a descriptor for the directory containing the requested pidfile, and later use unlinkat() to remove it.
A commit references this bug: Author: oshogbo Date: Thu Aug 10 16:45:06 UTC 2017 New revision: 322369 URL: https://svnweb.freebsd.org/changeset/base/322369 Log: Store directory descriptor in the pidfh structure and use unlinkat(2) function instead of unlink(2). Now when pidfile_remove() uses unlinkat(2) to remove the pidfile it is safe to use this function in capability mode. Style fix: sort headers. PR: 220524 Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D11692 Changes: head/lib/libutil/pidfile.c
Can we close this bug?
(In reply to Mariusz Zaborski from comment #2) Sure.