Hi,

Here's another one for switchd(8) which removes cpath promise from pledge(2)

OK?

Index: control.c
===================================================================
RCS file: /cvs/src/usr.sbin/switchd/control.c,v
retrieving revision 1.8
diff -u -p -u -r1.8 control.c
--- control.c   17 Jan 2017 22:10:56 -0000      1.8
+++ control.c   3 Aug 2018 06:53:38 -0000
@@ -70,11 +70,10 @@ control_run(struct privsep *ps, struct p
        /*
         * pledge in the control process:
         * stdio - for malloc and basic I/O including events.
-        * cpath - for managing the control socket.
         * unix - for the control socket.
         * recvfd - for the proc fd exchange.
         */
-       if (pledge("stdio cpath unix recvfd", NULL) == -1)
+       if (pledge("stdio unix recvfd", NULL) == -1)
                fatal("pledge");
 }
 
@@ -194,16 +193,6 @@ control_listen(struct control_sock *cs)
        evtimer_set(&cs->cs_evt, control_accept, cs);
 
        return (0);
-}
-
-void
-control_cleanup(struct control_sock *cs)
-{
-       if (cs->cs_name == NULL)
-               return;
-       event_del(&cs->cs_ev);
-       event_del(&cs->cs_evt);
-       (void)unlink(cs->cs_name);
 }
 
 /* ARGSUSED */
Index: proc.c
===================================================================
RCS file: /cvs/src/usr.sbin/switchd/proc.c,v
retrieving revision 1.12
diff -u -p -u -r1.12 proc.c
--- proc.c      29 May 2017 12:56:26 -0000      1.12
+++ proc.c      3 Aug 2018 06:53:38 -0000
@@ -475,9 +475,6 @@ proc_shutdown(struct privsep_proc *p)
 {
        struct privsep  *ps = p->p_ps;
 
-       if (p->p_id == PROC_CONTROL && ps)
-               control_cleanup(&ps->ps_csock);
-
        if (p->p_shutdown != NULL)
                (*p->p_shutdown)();
 
Index: proc.h
===================================================================
RCS file: /cvs/src/usr.sbin/switchd/proc.h,v
retrieving revision 1.6
diff -u -p -u -r1.6 proc.h
--- proc.h      9 Jan 2017 14:49:22 -0000       1.6
+++ proc.h      3 Aug 2018 06:53:38 -0000
@@ -160,7 +160,6 @@ int  proc_flush_imsg(struct privsep *, e
 /* control.c */
 int     control_init(struct privsep *, struct control_sock *);
 int     control_listen(struct control_sock *);
-void    control_cleanup(struct control_sock *);
 struct ctl_conn
        *control_connbyfd(int);
 void    control(struct privsep *, struct privsep_proc *);

Reply via email to