From ingham@fatman.i-pi.com  Tue Sep  8 20:30:06 1998
Received: from fatman.i-pi.com (fatman.i-pi.com [198.49.217.3])
          by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id UAA10095
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 8 Sep 1998 20:30:04 -0700 (PDT)
          (envelope-from ingham@fatman.i-pi.com)
Received: (from ingham@localhost)
	by fatman.i-pi.com (8.8.8/8.8.8) id VAA08519;
	Tue, 8 Sep 1998 21:29:55 -0600 (MDT)
	(envelope-from ingham)
Message-Id: <199809090329.VAA08519@fatman.i-pi.com>
Date: Tue, 8 Sep 1998 21:29:55 -0600 (MDT)
From: Kenneth Ingham <ingham@fatman.i-pi.com>
Reply-To: ingham@fatman.i-pi.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: Improved error messages from apm
X-Send-Pr-Version: 3.2

>Number:         7869
>Category:       bin
>Synopsis:       Improved error messages from apm
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Sep  8 20:40:00 PDT 1998
>Closed-Date:    Thu Jun 1 19:31:16 PDT 2000
>Last-Modified:  Thu Jun 01 19:31:52 PDT 2000
>Originator:     Kenneth Ingham
>Release:        FreeBSD 2.2.7-RELEASE i386
>Organization:
Kenneth Ingham Consulting
>Environment:

When apm cannot open /dev/apm

>Description:

When apm cannot open /dev/apm, the error message does not give clues as
to why it cannot open the device.

>How-To-Repeat:

I didn't have apm enabled in the kernel.  However, this was not obvious
from the error message.

>Fix:

Apply this patch to /usr/src/usr.sbin/apm/apm.c

*** apm.c	Tue Sep  8 21:23:05 1998
--- apm.c.orig	Tue Sep  8 21:22:04 1998
***************
*** 25,31 ****
  #include <sys/file.h>
  #include <sys/ioctl.h>
  #include <unistd.h>
- #include <errno.h>
  #include <machine/apm_bios.h>
  
  #define APMDEV	"/dev/apm"
--- 25,30 ----
***************
*** 161,167 ****
  finish_option:
  	fd = open(APMDEV, O_RDWR);
  	if (fd == -1) {
! 		warnx("can't open %s: %s", APMDEV, strerror(errno));
  		return 1;
  	}
  	if (sleep)
--- 160,166 ----
  finish_option:
  	fd = open(APMDEV, O_RDWR);
  	if (fd == -1) {
! 		warnx("can't open %s", APMDEV);
  		return 1;
  	}
  	if (sleep)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: nrahlstr 
State-Changed-When: Thu Jun 1 19:31:16 PDT 2000 
State-Changed-Why:  
Fixed by green in revision 1.22 of apm.c.  Thanks. 


http://www.freebsd.org/cgi/query-pr.cgi?pr=7869 
>Unformatted:
