Bug 96931 - Incorrect error message
Incorrect error message
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: isdn4k-utils (Show other bugs)
8.0
All Linux
medium Severity low
: ---
: ---
Assigned To: Ngo Than
Jay Turner
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2003-06-06 13:02 EDT by Peter Benie
Modified: 2015-01-07 19:05 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2003-06-10 08:19:42 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Peter Benie 2003-06-06 13:02:50 EDT
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 Ngo Than 2003-06-10 08:19:42 EDT
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.