]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
OpenBSD: Avoid a pledge segfault when exiting
authorRoy Marples <roy@marples.name>
Wed, 20 May 2020 16:14:12 +0000 (17:14 +0100)
committerRoy Marples <roy@marples.name>
Wed, 20 May 2020 16:14:12 +0000 (17:14 +0100)
No cpath permission anymore, so we can't unlink the pidfile.
If compiled for pledge then don't bother.

compat/pidfile.c

index bd7887ac6daf6813fe68c10915528806519a1cd5..9dfd9c468a7aefd33ccb448a69867c3eb2622450 100644 (file)
@@ -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;
        }