NetBSD Problem Report #14550
Received: (qmail 17556 invoked from network); 12 Nov 2001 11:47:43 -0000
Message-Id: <200111121147.fACBlRB09398@nutcracker.stacken.kth.se>
Date: Mon, 12 Nov 2001 12:47:27 +0100 (CET)
From: lha@stacken.kth.se
Reply-To: lha@stacken.kth.se
To: gnats-bugs@gnats.netbsd.org
Subject: asapm doesn't work with `new' apm
X-Send-Pr-Version: 3.95
>Number: 14550
>Category: pkg
>Synopsis: asapm doesn't work with `new' apm
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Nov 12 11:48:00 +0000 2001
>Closed-Date: Mon Nov 26 19:56:42 +0000 2001
>Last-Modified: Mon Nov 26 19:56:42 +0000 2001
>Originator: Love
>Release: NetBSD 1.5Y
>Organization:
Stacken Computer Club
>Environment:
System: NetBSD nutcracker.stacken.kth.se 1.5Y NetBSD 1.5Y (NUTCRACKER) #0: Thu Nov 8 10:01:57 CET 2001 lha@nutcracker.stacken.kth.se:/usr/src/sys/arch/i386/compile/NUTCRACKER i386
Architecture: i386
Machine: i386
>Description:
Since apm got support for probing individual batteries asapm
doesn't work. This is since the apm_info structure isn't
initialized before the ioctl() is done.
>How-To-Repeat:
Compile asapm and try to use it.
>Fix:
I've sent a mail to the asapm maintainer.
: lha@nutcracker ; pwd
/usr/pkgsrc/sysutils/asapm
: root@nutcracker ; cvs diff -N
? work.i386
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/sysutils/asapm/distinfo,v
retrieving revision 1.3
diff -w -u -r1.3 distinfo
--- distinfo 2001/07/15 10:50:07 1.3
+++ distinfo 2001/11/12 11:37:06
@@ -4,3 +4,4 @@
Size (asapm-2.10.tar.gz) = 51304 bytes
SHA1 (patch-aa) = 570d2240f6afbf78d3cd72e1c1b963beb7ae074d
SHA1 (patch-ab) = 8796f1f6220ecdbd23d360bb18f721e1ef83febf
+SHA1 (patch-ac) = c7d581dabe58cdf1773aa0b41d9bd3c575d3cf1c
Index: patches/patch-ac
===================================================================
RCS file: patch-ac
diff -N patch-ac
--- /dev/null Sun May 20 17:40:04 2001
+++ patch-ac Mon Nov 12 03:37:06 2001
@@ -0,0 +1,34 @@
+$NetBSD$
+
+--- apm_read.c.foo Mon May 31 13:47:49 1999
++++ apm_read.c Mon Nov 12 12:33:49 2001
+@@ -98,12 +98,14 @@
+ {
+ int fd;
+ struct apm_info info;
++ memset(&info, 0, sizeof(info));
+ if ((fd = open(apm_device_file, O_RDONLY)) == -1) {
+ error_handle(1, "");
+ return;
+ }
+ if (ioctl(fd, APMIO_GETINFO, &info) == -1) {
+ error_handle(4, "");
++ close(fd);
+ return;
+ }
+ close(fd);
+@@ -138,12 +140,14 @@
+ {
+ int fd;
+ struct apm_power_info info;
++ memset(&info, 0, sizeof(info));
+ if ((fd = open(apm_device_file, O_RDONLY)) == -1) {
+ error_handle(1, "");
+ return;
+ }
+ if (ioctl(fd, APM_IOC_GETPOWER, &info) == -1) {
+ error_handle(4, "");
++ close(fd);
+ return;
+ }
+ close(fd);
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: wiz
State-Changed-When: Mon Nov 26 11:56:20 PST 2001
State-Changed-Why:
Updated the package to 2.11, which incorporates your patch.
Thanks for the PR!
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.