or write in send_command failed.
Found by codechecker.
OK deraadt
-/* $OpenBSD: apm.c,v 1.42 2022/09/10 10:10:09 sdk Exp $ */
+/* $OpenBSD: apm.c,v 1.43 2022/11/09 18:48:11 mbuhl Exp $ */
/*
* Copyright (c) 1996 John T. Kohl
char *msg;
int ret;
+ bzero(&reply, sizeof reply);
+
switch (action) {
case NONE:
case SUSPEND:
printf("%s...\n", msg);
ret = send_command(fd, &command, &reply);
- if (reply.error)
+ if (ret == 0 && reply.error)
errx(1, "%s: %s", apm_state(reply.newstate), strerror(reply.error));
exit(ret);
}