changeset 5243:0d5671483751 draft

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.
author Roy Marples <roy@marples.name>
date Wed, 20 May 2020 17:14:12 +0100
parents 0dd9b7f7cf6b
children 5ebd308638cd
files compat/pidfile.c
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/compat/pidfile.c	Wed May 20 15:44:19 2020 +0000
+++ b/compat/pidfile.c	Wed May 20 17:14:12 2020 +0100
@@ -86,7 +86,9 @@
 	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;
 	}