summaryrefslogtreecommitdiffstats
path: root/tcpsyslog.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-21 14:56:49 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-21 14:56:49 +0000
commit9a72402b80c9b67abae090645ba30adf697f3025 (patch)
tree665d90e51d984b1a217d3a257e7ae7a039e556eb /tcpsyslog.c
parent4e6bba7df8170514183040897e363528c574be0e (diff)
downloadrsyslog-9a72402b80c9b67abae090645ba30adf697f3025.tar.gz
rsyslog-9a72402b80c9b67abae090645ba30adf697f3025.tar.xz
rsyslog-9a72402b80c9b67abae090645ba30adf697f3025.zip
cleaned up code (resulting in some shuffeling from syslogd.c to the "right"
module)
Diffstat (limited to 'tcpsyslog.c')
-rw-r--r--tcpsyslog.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/tcpsyslog.c b/tcpsyslog.c
index f4a94bb8..5493a664 100644
--- a/tcpsyslog.c
+++ b/tcpsyslog.c
@@ -82,6 +82,30 @@ static gss_cred_id_t gss_server_creds = GSS_C_NO_CREDENTIAL;
char *gss_listen_service_name = NULL;
#endif
+
+/* code to free all sockets within a socket table.
+ * A socket table is a descriptor table where the zero
+ * element has the count of elements. This is used for
+ * listening sockets. The socket table itself is also
+ * freed.
+ * A POINTER to this structure must be provided, thus
+ * double indirection!
+ * rgerhards, 2007-06-28
+ */
+static void freeAllSockets(int **socks)
+{
+ assert(socks != NULL);
+ assert(*socks != NULL);
+ while(**socks) {
+ dbgprintf("Closing socket %d.\n", (*socks)[**socks]);
+ close((*socks)[**socks]);
+ (**socks)--;
+ }
+ free(*socks);
+ socks = NULL;
+}
+
+
/* configure TCP listener settings. This is called during command
* line parsing. The argument following -t is supplied as an argument.
* The format of this argument is