Version 1.8.0.0
[socat.git] / xioexit.c
blobc3582f5235c356e9c0e1786d132d9153e6bc3f21
1 /* source: xioexit.c */
2 /* Copyright Gerhard Rieger and contributors (see file CHANGES) */
3 /* Published under the GNU General Public License V.2, see file COPYING */
5 /* this file contains the source for the extended exit function */
7 #include "xiosysincludes.h"
8 #include "compat.h"
9 #include "xio.h"
10 #include "error.h"
13 /* this function closes all open xio sockets on exit, if they are still open.
14 It must be registered with atexit(). */
15 void xioexit(void) {
16 int i;
18 diag_in_handler = 0;
19 Debug("starting xioexit()");
20 for (i = 0; i < XIO_MAXSOCK; ++i) {
21 if (sock[i] != NULL && sock[i]->tag != XIO_TAG_INVALID &&
22 !(sock[i]->tag & XIO_TAG_CLOSED)) {
23 xioclose(sock[i]);
26 Debug("finished xioexit()");