summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorSebastian Benoit <benno@cvs.openbsd.org>2017-10-04 18:08:27 +0000
committerSebastian Benoit <benno@cvs.openbsd.org>2017-10-04 18:08:27 +0000
commita0730b83ba46716beaa40a0bbbe9645ee4a0c988 (patch)
treefa53adb4717dd2115cbf1f86c21a0bca35e9c914 /usr.sbin
parent6af059abef33d2763ecfdae79a8d862ea1aef82b (diff)
inetd needs cpath pledge to unlink unix socket at program termination.
From Anthony Coulter - thanks! ok jca@
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/inetd/inetd.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/usr.sbin/inetd/inetd.c b/usr.sbin/inetd/inetd.c
index 8879121105b..2e3e5b174b6 100644
--- a/usr.sbin/inetd/inetd.c
+++ b/usr.sbin/inetd/inetd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inetd.c,v 1.154 2016/08/25 05:23:19 tedu Exp $ */
+/* $OpenBSD: inetd.c,v 1.155 2017/10/04 18:08:26 benno Exp $ */
/*
* Copyright (c) 1983,1991 The Regents of the University of California.
@@ -1763,8 +1763,13 @@ spawn(int ctrl, short events, void *xsep)
return;
}
- if (pledge("stdio rpath getpw inet proc exec id", NULL) == -1)
- err(1, "pledge");
+ if (sep->se_family == AF_UNIX) {
+ if (pledge("stdio rpath cpath getpw inet proc exec id", NULL) == -1)
+ err(1, "pledge");
+ } else {
+ if (pledge("stdio rpath getpw inet proc exec id", NULL) == -1)
+ err(1, "pledge");
+ }
if (pid && sep->se_wait) {
sep->se_wait = pid;