Module Name:    src
Committed By:   jruoho
Date:           Sat Apr 24 20:44:33 UTC 2010

Modified Files:
        src/include: paths.h
        src/usr.sbin/powerd: powerd.c

Log Message:
Define _PATH_POWER and use it.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/include/paths.h
cvs rdiff -u -r1.13 -r1.14 src/usr.sbin/powerd/powerd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/include/paths.h
diff -u src/include/paths.h:1.36 src/include/paths.h:1.37
--- src/include/paths.h:1.36	Wed Feb  3 18:11:18 2010
+++ src/include/paths.h	Sat Apr 24 20:44:33 2010
@@ -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"

Index: src/usr.sbin/powerd/powerd.c
diff -u src/usr.sbin/powerd/powerd.c:1.13 src/usr.sbin/powerd/powerd.c:1.14
--- src/usr.sbin/powerd/powerd.c:1.13	Sat Dec 15 19:44:56 2007
+++ src/usr.sbin/powerd/powerd.c	Sat Apr 24 20:44:33 2010
@@ -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 @@
 
 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 @@
 		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 @@
 	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 @@
 		break;
 	default:
 		syslog(LOG_INFO, "unknown %s event type: %d",
-		    _PATH_DEV_POWER, pev.pev_type);
+		    _PATH_POWER, pev.pev_type);
 	}
 
 	goto again;

Reply via email to