summaryrefslogtreecommitdiff
path: root/usr.sbin/apmd
diff options
context:
space:
mode:
authorkn <kn@cvs.openbsd.org>2021-03-16 09:00:44 +0000
committerkn <kn@cvs.openbsd.org>2021-03-16 09:00:44 +0000
commitdd1675f5a0cf1e325de9ad02c9f71c6e5369fc93 (patch)
tree3268ff61f825cf0dfa8648653b071832d0a8e950 /usr.sbin/apmd
parentd75658567a61f4c9ccc29945910b3a2bb46f0247 (diff)
Do not delete control socket upon exit
The control socket is not unveiled, therefore accounting would report unveil violations whenever apmd(8) stopped (normally). As discussed and done with other daemons such as relayd which also employ no pledge (due to inherent limitations) but unveil effecting all of /, simply stop removing the socket upon exit and leave it to the next apmd which completely sets up its control socket anew at startup. Violations reported by anton Feedback OK semarie mestre
Diffstat (limited to 'usr.sbin/apmd')
-rw-r--r--usr.sbin/apmd/apmd.c15
1 files changed, 1 insertions, 14 deletions
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c
index ae8cef32be8..8e487963d27 100644
--- a/usr.sbin/apmd/apmd.c
+++ b/usr.sbin/apmd/apmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apmd.c,v 1.100 2021/03/11 18:12:41 kn Exp $ */
+/* $OpenBSD: apmd.c,v 1.101 2021/03/16 09:00:43 kn Exp $ */
/*
* Copyright (c) 1995, 1996 John T. Kohl
@@ -72,7 +72,6 @@ void resumed(int ctl_fd);
void setperfpolicy(char *policy);
void sigexit(int signo);
void do_etc_file(const char *file);
-void sockunlink(void);
void error(const char *fmt, const char *arg);
void set_driver_messages(int fd, int mode);
@@ -80,7 +79,6 @@ void set_driver_messages(int fd, int mode);
void
sigexit(int signo)
{
- sockunlink();
_exit(1);
}
@@ -204,15 +202,6 @@ power_status(int fd, int force, struct apm_power_info *pinfo)
return acon;
}
-char socketname[PATH_MAX];
-
-void
-sockunlink(void)
-{
- if (socketname[0])
- remove(socketname);
-}
-
int
bind_socket(const char *sockname)
{
@@ -238,8 +227,6 @@ bind_socket(const char *sockname)
error("cannot set socket mode/owner/group to 660/0/0", NULL);
listen(sock, 1);
- strlcpy(socketname, sockname, sizeof socketname);
- atexit(sockunlink);
return sock;
}