fixed problems with FD_ISSET and glibc, if descriptor is not open.

This commit is contained in:
calle 1998-02-08 09:36:51 +00:00
parent b630f12714
commit 3976544076
1 changed files with 15 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $Id: isdnlog.c,v 1.13 1997/06/22 23:03:23 luethje Exp $
/* $Id: isdnlog.c,v 1.14 1998/02/08 09:36:51 calle Exp $
*
* ISDN accounting for isdn4linux. (log-module)
*
@ -19,6 +19,9 @@
* along with this program; if not, write to the Free Software
*
* $Log: isdnlog.c,v $
* Revision 1.14 1998/02/08 09:36:51 calle
* fixed problems with FD_ISSET and glibc, if descriptor is not open.
*
* Revision 1.13 1997/06/22 23:03:23 luethje
* In subsection FLAGS it will be checked if the section name FLAG is korrect
* isdnlog recognize calls abroad
@ -143,6 +146,8 @@ static void hup_handler(int isig)
/*****************************************************************************/
#define X_FD_ISSET(fd, mask) ((fd) >= 0 && FD_ISSET(fd,mask))
static void loop(void)
{
auto fd_set readmask;
@ -223,8 +228,9 @@ static void loop(void)
now();
for (Cnt = first_descr; Cnt < socket_size(sockets); Cnt++) {
if (FD_ISSET(sockets[Cnt].descriptor, &exceptmask)) {
if (X_FD_ISSET(sockets[Cnt].descriptor, &exceptmask)) {
if (sockets[Cnt].fp == NULL) {
disconnect_client(Cnt);
break;
@ -242,7 +248,7 @@ static void loop(void)
break;
} /* else */
}
else if (FD_ISSET(sockets[Cnt].descriptor, &readmask))
else if (X_FD_ISSET(sockets[Cnt].descriptor, &readmask))
if (sockets[Cnt].fp == NULL) {
eval_message(Cnt);
/* Arbeite immer nur ein Client ab, du weisst nicht, ob der
@ -253,7 +259,7 @@ static void loop(void)
Print_Cmd_Output(Cnt);
} /* for */
if (xinfo && FD_ISSET(sockets[IN_PORT].descriptor, &readmask)) {
if (xinfo && X_FD_ISSET(sockets[IN_PORT].descriptor, &readmask)) {
len = sizeof(incoming);
if ((NewSocket = accept(sockets[IN_PORT].descriptor, &incoming, &len)) == -1)
@ -270,16 +276,18 @@ static void loop(void)
NewClient = queuenumber - 1;
} /* else */
}
else if (FD_ISSET(sockets[ISDNINFO].descriptor, &readmask))
else if (X_FD_ISSET(sockets[ISDNINFO].descriptor, &readmask))
moreinfo();
else if (FD_ISSET(sockets[ISDNCTRL].descriptor, &readmask))
else if (X_FD_ISSET(sockets[ISDNCTRL].descriptor, &readmask))
(void)morectrl(0);
else if (FD_ISSET(sockets[ISDNCTRL2].descriptor, &readmask))
else if (X_FD_ISSET(sockets[ISDNCTRL2].descriptor, &readmask))
(void)morectrl(1);
} /* else */
} /* while */
} /* loop */
#undef X_FD_ISSET
/*****************************************************************************/
int print_in_modules(const char *fmt, ...)