File: xioexit.c

package info (click to toggle)
socat 1.7.3.2-2
  • links: PTS
  • area: main
  • in suites: bullseye, sid
  • size: 3,888 kB
  • sloc: ansic: 28,032; sh: 11,782; makefile: 146
file content (26 lines) | stat: -rw-r--r-- 702 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* source: xioexit.c */
/* Copyright Gerhard Rieger and contributors (see file CHANGES) */
/* Published under the GNU General Public License V.2, see file COPYING */

/* this file contains the source for the extended exit function */

#include "xiosysincludes.h"
#include "compat.h"
#include "xio.h"
#include "error.h"


/* this function closes all open xio sockets on exit, if they are still open.
   It must be registered with atexit(). */ 
void xioexit(void) {
   int i;

   diag_in_handler = 0;
   Debug("starting xioexit()");
   for (i = 0; i < XIO_MAXSOCK; ++i) {
      if (sock[i] != NULL && sock[i]->tag != XIO_TAG_INVALID) {
	 xioclose(sock[i]);
      }
   }
   Debug("finished xioexit()");
}