summaryrefslogtreecommitdiff
path: root/usr.sbin/apmd
diff options
context:
space:
mode:
authorJeremie Courreges-Anglas <jca@cvs.openbsd.org>2021-04-06 22:12:49 +0000
committerJeremie Courreges-Anglas <jca@cvs.openbsd.org>2021-04-06 22:12:49 +0000
commit45e9bd6f266f7c639190eb06bbbc9397c15db1ab (patch)
treec6347e4dbbd4774faa41eb37c78b66cbffdf4df3 /usr.sbin/apmd
parent960392a9431f41764d65211468ad6d8916b27f71 (diff)
handle_client() doesn't need to return a value
Its caller doesn't use the return value so zap it. Also zap tentative error handling in the caller. ok kn@
Diffstat (limited to 'usr.sbin/apmd')
-rw-r--r--usr.sbin/apmd/apmd.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/usr.sbin/apmd/apmd.c b/usr.sbin/apmd/apmd.c
index a17dc717dd4..a6a302978e2 100644
--- a/usr.sbin/apmd/apmd.c
+++ b/usr.sbin/apmd/apmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apmd.c,v 1.103 2021/04/06 20:30:32 kn Exp $ */
+/* $OpenBSD: apmd.c,v 1.104 2021/04/06 22:12:48 jca Exp $ */
/*
* Copyright (c) 1995, 1996 John T. Kohl
@@ -64,7 +64,7 @@ extern char *__progname;
void usage(void);
int power_status(int fd, int force, struct apm_power_info *pinfo);
int bind_socket(const char *sn);
-enum apm_state handle_client(int sock_fd, int ctl_fd);
+void handle_client(int sock_fd, int ctl_fd);
int suspend(int ctl_fd);
int stand_by(int ctl_fd);
int hibernate(int ctl_fd);
@@ -231,7 +231,7 @@ bind_socket(const char *sockname)
return sock;
}
-enum apm_state
+void
handle_client(int sock_fd, int ctl_fd)
{
/* accept a handle from the client, process it, then clean up */
@@ -251,19 +251,19 @@ handle_client(int sock_fd, int ctl_fd)
cli_fd = accept(sock_fd, (struct sockaddr *)&from, &fromlen);
if (cli_fd == -1) {
logmsg(LOG_INFO, "client accept failure: %s", strerror(errno));
- return NORMAL;
+ return;
}
if (recv(cli_fd, &cmd, sizeof(cmd), 0) != sizeof(cmd)) {
(void) close(cli_fd);
logmsg(LOG_INFO, "client size botch");
- return NORMAL;
+ return;
}
if (cmd.vno != APMD_VNO) {
close(cli_fd); /* terminate client */
/* no error message, just drop it. */
- return NORMAL;
+ return;
}
bzero(&reply, sizeof(reply));
@@ -324,8 +324,6 @@ handle_client(int sock_fd, int ctl_fd)
if (send(cli_fd, &reply, sizeof(reply), 0) != sizeof(reply))
logmsg(LOG_INFO, "reply to client botched");
close(cli_fd);
-
- return reply.newstate;
}
int
@@ -528,12 +526,8 @@ main(int argc, char *argv[])
break;
if (rv == 1 && ev->ident == sock_fd) {
- int state;
-
- if ((state = handle_client(sock_fd, ctl_fd)) == -1)
- logmsg(LOG_WARNING, "%s: %s", apm_state(state), strerror(errno));
- else
- continue;
+ handle_client(sock_fd, ctl_fd);
+ continue;
}
suspends = standbys = hibernates = resumes = 0;