Fixed error messages when opening /dev/isdnctrl - /dev/isdn/isdnctrl etc.,
only /dev/isdnctrl was mentioned and people assumed that isdnctrl wasn't devfs-compliant yet when the open failed due to other reasons. Zero the phone struct before use.
This commit is contained in:
parent
23ad3f4a9c
commit
8f0ac2615c
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: isdnctrl.c,v 1.49 2001/06/11 17:55:58 paul Exp $
|
/* $Id: isdnctrl.c,v 1.50 2002/01/31 19:53:41 paul Exp $
|
||||||
* ISDN driver for Linux. (Control-Utility)
|
* ISDN driver for Linux. (Control-Utility)
|
||||||
*
|
*
|
||||||
* Copyright 1994,95 by Fritz Elfert (fritz@isdn4linux.de)
|
* Copyright 1994,95 by Fritz Elfert (fritz@isdn4linux.de)
|
||||||
|
@ -21,6 +21,12 @@
|
||||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*
|
*
|
||||||
* $Log: isdnctrl.c,v $
|
* $Log: isdnctrl.c,v $
|
||||||
|
* Revision 1.50 2002/01/31 19:53:41 paul
|
||||||
|
* Fixed error messages when opening /dev/isdnctrl - /dev/isdn/isdnctrl etc.,
|
||||||
|
* only /dev/isdnctrl was mentioned and people assumed that isdnctrl wasn't
|
||||||
|
* devfs-compliant yet when the open failed due to other reasons.
|
||||||
|
* Zero the phone struct before use.
|
||||||
|
*
|
||||||
* Revision 1.49 2001/06/11 17:55:58 paul
|
* Revision 1.49 2001/06/11 17:55:58 paul
|
||||||
* Added 'break' statement after handling data version 5 (otherwise fallthrough
|
* Added 'break' statement after handling data version 5 (otherwise fallthrough
|
||||||
* into data version 6 handling!!)
|
* into data version 6 handling!!)
|
||||||
|
@ -310,6 +316,10 @@ int set_isdn_net_ioctl_phone(isdn_net_ioctl_phone *ph, char *name,
|
||||||
fprintf(stderr, "phone-number must not exceed %d characters\n", 19);
|
fprintf(stderr, "phone-number must not exceed %d characters\n", 19);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* null termination happens automatically because
|
||||||
|
* we clear the entire struct first
|
||||||
|
*/
|
||||||
strncpy(ph->phone_5.name, name, sizeof(ph->phone_5.name)-1);
|
strncpy(ph->phone_5.name, name, sizeof(ph->phone_5.name)-1);
|
||||||
strncpy(ph->phone_5.phone, phone, sizeof(ph->phone_5.phone)-1);
|
strncpy(ph->phone_5.phone, phone, sizeof(ph->phone_5.phone)-1);
|
||||||
ph->phone_5.outgoing = outflag;
|
ph->phone_5.outgoing = outflag;
|
||||||
|
@ -581,11 +591,12 @@ static void statusif(int isdnctrl, char *name, int errexit)
|
||||||
if (isdninfo < 0)
|
if (isdninfo < 0)
|
||||||
isdninfo = open("/dev/isdninfo", O_RDONLY);
|
isdninfo = open("/dev/isdninfo", O_RDONLY);
|
||||||
if (isdninfo < 0) {
|
if (isdninfo < 0) {
|
||||||
perror("Can't open /dev/isdninfo");
|
perror("Can't open /dev/isdninfo or /dev/isdn/isdninfo");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(&phone, 0, sizeof phone);
|
||||||
set_isdn_net_ioctl_phone(&phone, name, "", 0);
|
set_isdn_net_ioctl_phone(&phone, name, "", 0);
|
||||||
rc = ioctl(isdninfo, IIOCNETGPN, &phone);
|
rc = ioctl(isdninfo, IIOCNETGPN, &phone);
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
|
@ -1602,7 +1613,7 @@ void check_version(int report) {
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
fd = open("/dev/isdninfo", O_RDONLY);
|
fd = open("/dev/isdninfo", O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
perror("/dev/isdninfo");
|
perror("Can't open /dev/isdninfo or /dev/isdn/isdninfo");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
data_version = ioctl(fd, IIOCGETDVR, 0);
|
data_version = ioctl(fd, IIOCGETDVR, 0);
|
||||||
|
@ -1750,7 +1761,7 @@ int main(int argc, char **argv)
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
fd = open("/dev/isdnctrl", O_RDWR);
|
fd = open("/dev/isdnctrl", O_RDWR);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
perror("/dev/isdnctrl");
|
perror("Can't open /dev/isdnctrl or /dev/isdn/isdnctrl");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue