Bug 96931

Summary: Incorrect error message
Product: [Retired] Red Hat Linux Reporter: Peter Benie <pjb1008>
Component: isdn4k-utilsAssignee: Than Ngo <than>
Status: CLOSED RAWHIDE QA Contact: Jay Turner <jturner>
Severity: low Docs Contact:
Priority: medium    
Version: 8.0CC: srevivo
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-06-10 12:19:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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