Explicitly set stdio buffer for /dev/isdninfo to 2048, as it has
happened that stdio used 1024, and /dev/isdninfo doesn't support partial reads (0 bytes are returned). Usually not a problem, but with more than one channel connected, a line of > 1024 bytes is returned.
This commit is contained in:
parent
bb74d7be57
commit
618b43206b
|
@ -169,6 +169,7 @@ void scan_int(char * buffer, int (*field)[], int max) {
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
|
|
||||||
FILE * isdninfo;
|
FILE * isdninfo;
|
||||||
|
static char fbuf[2048];
|
||||||
char buf[IM_BUFSIZE];
|
char buf[IM_BUFSIZE];
|
||||||
|
|
||||||
char * idmap[ISDN_MAX_CHANNELS];
|
char * idmap[ISDN_MAX_CHANNELS];
|
||||||
|
@ -180,13 +181,13 @@ int main(int argc, char **argv) {
|
||||||
|
|
||||||
int i, lines;
|
int i, lines;
|
||||||
|
|
||||||
isdninfo = fopen("/dev/isdn/isdninfo", "r");
|
if (!(isdninfo = fopen("/dev/isdninfo", "r"))) {
|
||||||
if (!isdninfo)
|
if (!(isdninfo = fopen("/dev/isdn/isdninfo", "r"))) {
|
||||||
isdninfo = fopen("/dev/isdninfo", "r");
|
perror("imontty: can't open /dev/isdn/isdninfo nor /dev/isdninfo");
|
||||||
if (!isdninfo) {
|
return 1;
|
||||||
perror("imontty: can't open /dev/isdninfo");
|
}
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
setvbuf(isdninfo, fbuf, _IOFBF, sizeof(fbuf)); /* up to 2048 needed */
|
||||||
|
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
readphonebook(argv[1]);
|
readphonebook(argv[1]);
|
||||||
|
|
Loading…
Reference in New Issue