Define _PATH_POWER and use it.

This commit is contained in:
jruoho 2010-04-24 20:44:33 +00:00
parent 1da7b01e3b
commit 73bd86de75
2 changed files with 8 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: paths.h,v 1.36 2010/02/03 18:11:18 roy Exp $ */
/* $NetBSD: paths.h,v 1.37 2010/04/24 20:44:33 jruoho Exp $ */
/*
* Copyright (c) 1989, 1993
@ -82,6 +82,7 @@
#define _PATH_MIXER0 "/dev/mixer0"
#define _PATH_NOLOGIN "/etc/nologin"
#define _PATH_PRINTCAP "/etc/printcap"
#define _PATH_POWER "/dev/power"
#define _PATH_PUD "/dev/pud"
#define _PATH_PUFFS "/dev/puffs"
#define _PATH_RANDOM "/dev/random"

View File

@ -1,4 +1,4 @@
/* $NetBSD: powerd.c,v 1.13 2007/12/15 19:44:56 perry Exp $ */
/* $NetBSD: powerd.c,v 1.14 2010/04/24 20:44:33 jruoho Exp $ */
/*
* Copyright (c) 2003 Wasabi Systems, Inc.
@ -46,6 +46,7 @@
#include <sys/wait.h>
#include <errno.h>
#include <fcntl.h>
#include <paths.h>
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
@ -58,7 +59,6 @@ int debug;
static int kq;
#define _PATH_DEV_POWER "/dev/power"
#define _PATH_POWERD_SCRIPTS "/etc/powerd/scripts"
static void usage(void) __dead;
@ -110,8 +110,8 @@ main(int argc, char *argv[])
exit(EX_OSERR);
}
if ((fd = open(_PATH_DEV_POWER, O_RDONLY|O_NONBLOCK, 0600)) == -1) {
syslog(LOG_ERR, "open %s: %m", _PATH_DEV_POWER);
if ((fd = open(_PATH_POWER, O_RDONLY|O_NONBLOCK, 0600)) == -1) {
syslog(LOG_ERR, "open %s: %m", _PATH_POWER);
exit(EX_OSERR);
}
@ -266,7 +266,7 @@ dispatch_dev_power(struct kevent *ev)
if (read(fd, &pev, sizeof(pev)) != sizeof(pev)) {
if (errno == EWOULDBLOCK)
return;
syslog(LOG_ERR, "read of %s: %m", _PATH_DEV_POWER);
syslog(LOG_ERR, "read of %s: %m", _PATH_POWER);
exit(EX_OSERR);
}
@ -281,7 +281,7 @@ dispatch_dev_power(struct kevent *ev)
break;
default:
syslog(LOG_INFO, "unknown %s event type: %d",
_PATH_DEV_POWER, pev.pev_type);
_PATH_POWER, pev.pev_type);
}
goto again;