From: Roy Marples Date: Wed, 20 May 2020 16:14:12 +0000 (+0100) Subject: OpenBSD: Avoid a pledge segfault when exiting X-Git-Tag: v9.1.0~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=270891b2a8a73ffd03958723c9d9fbfa994bdc8c;p=thirdparty%2Fdhcpcd.git OpenBSD: Avoid a pledge segfault when exiting No cpath permission anymore, so we can't unlink the pidfile. If compiled for pledge then don't bother. --- diff --git a/compat/pidfile.c b/compat/pidfile.c index bd7887ac..9dfd9c46 100644 --- a/compat/pidfile.c +++ b/compat/pidfile.c @@ -86,7 +86,9 @@ pidfile_clean(void) else if (ftruncate(pidfile_fd, 0) == -1) error = errno; else { - (void) unlink(pidfile_path); +#ifndef HAVE_PLEDGE /* Avoid a pledge violating segfault. */ + (void)unlink(pidfile_path); +#endif error = 0; }