Bug 96931 - Incorrect error message
Summary: Incorrect error message
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: isdn4k-utils
Version: 8.0
Hardware: All
OS: Linux
medium
low
Target Milestone: ---
Assignee: Than Ngo
QA Contact: Jay Turner
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-06-06 17:02 UTC by Peter Benie
Modified: 2015-01-08 00:05 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2003-06-10 12:19:42 UTC
Embargoed:


Attachments (Terms of Use)

Description Peter Benie 2003-06-06 17:02:50 UTC
Description of problem:

In userisdnctl.c, lines 256-262, you have:
  fd = open("/dev/isdn/isdnctrl", O_RDWR);
  if (fd < 0)
    fd = open("/dev/isdnctrl", O_RDWR);
  if (fd < 0) {
    perror("Can't open /dev/isdnctrl or /dev/isdn/isdnctrl");
    exit(-1);
  }

If /dev/isdn/isdnctrl exists but cannot be opened and /dev/isdnctrl does not
exist, the error messsage will claim that neither /dev/isdnctrl nor
/dev/isdn/isdnctrl exist.

A better way to write this would be:

  int err;
  fd = open("/dev/isdn/isdnctrl", O_RDWR);
  err=errno;
  if (fd == -1 && err==ENOENT) {
    fd = open("/dev/isdnctrl", O_RDWR);
    if (fd == -1) {
      fprintf(stderr, "Can't open /dev/isdnctrl (%s) or /dev/isdn/isdnctrl (%s)",
                       strerror(err), strerror(errno));
      exit(-1);
    }
  }


Version-Release number of selected component (if applicable): 3.1-58

Comment 1 Than Ngo 2003-06-10 12:19:42 UTC
it's fixed in 3.1-68, which will be available in rawhide soon. thanks for your
report


Note You need to log in before you can comment on or make changes to this bug.