summaryrefslogtreecommitdiff
path: root/src/pluto/log.c
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2008-07-09 21:02:41 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2008-07-09 21:02:41 +0000
commitdb67c87db3c9089ea8d2e14f617bf3d9e2af261f (patch)
tree665c0caea83d34c11c1517c4c57137bb58cba6fb /src/pluto/log.c
parent1c088a8b6237ec67f63c23f97a0f2dc4e99af869 (diff)
downloadvyos-strongswan-db67c87db3c9089ea8d2e14f617bf3d9e2af261f.tar.gz
vyos-strongswan-db67c87db3c9089ea8d2e14f617bf3d9e2af261f.zip
[svn-upgrade] Integrating new upstream version, strongswan (4.2.4)
Diffstat (limited to 'src/pluto/log.c')
-rw-r--r--src/pluto/log.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/pluto/log.c b/src/pluto/log.c
index ca0576b69..0fb5f1d25 100644
--- a/src/pluto/log.c
+++ b/src/pluto/log.c
@@ -12,7 +12,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
- * RCSID $Id: log.c 3252 2007-10-06 21:24:50Z andreas $
+ * RCSID $Id: log.c 4024 2008-05-29 07:49:47Z andreas $
*/
#include <stdio.h>
@@ -65,7 +65,7 @@ const char *base_perpeer_logdir = PERPEERLOGDIR;
static int perpeer_count = 0;
/* from sys/queue.h */
-static CIRCLEQ_HEAD(,connection) perpeer_list;
+static TAILQ_HEAD(perpeer, connection) perpeer_list;
/* Context for logging.
@@ -88,19 +88,19 @@ init_log(const char *program)
if (log_to_syslog)
openlog(program, LOG_CONS | LOG_NDELAY | LOG_PID, LOG_AUTHPRIV);
- CIRCLEQ_INIT(&perpeer_list);
+ TAILQ_INIT(&perpeer_list);
}
void
close_peerlog(void)
{
- /* end of circular queue is given by pointer to "HEAD"
- * BUT if the queue is not initialized, this won't be true
- * so we must guard by test perpeer_list.cqh_first != NULL
- */
- if (perpeer_list.cqh_first != NULL)
- while (perpeer_list.cqh_first != (void *)&perpeer_list)
- perpeer_logclose(perpeer_list.cqh_first);
+ /* exit if the queue has not been initialized */
+ if (TAILQ_LAST(&perpeer_list, perpeer) == NULL)
+ return;
+
+ /* end of queue is given by pointer to "HEAD" */
+ while (TAILQ_LAST(&perpeer_list, perpeer) != (void *)&perpeer_list)
+ perpeer_logclose(TAILQ_LAST(&perpeer_list, perpeer));
}
void
@@ -231,7 +231,7 @@ perpeer_logclose(struct connection *c)
{
passert(perpeer_count > 0);
- CIRCLEQ_REMOVE(&perpeer_list, c, log_link);
+ TAILQ_REMOVE(&perpeer_list, c, log_link);
perpeer_count--;
fclose(c->log_file);
c->log_file=NULL;
@@ -366,13 +366,13 @@ open_peerlog(struct connection *c)
while (perpeer_count >= MAX_PEERLOG_COUNT)
{
/* can not be NULL because perpeer_count > 0 */
- passert(perpeer_list.cqh_last != (void *)&perpeer_list);
+ passert(TAILQ_LAST(&perpeer_list, perpeer) != (void *)&perpeer_list);
- perpeer_logclose(perpeer_list.cqh_last);
+ perpeer_logclose(TAILQ_LAST(&perpeer_list, perpeer));
}
/* insert this into the list */
- CIRCLEQ_INSERT_HEAD(&perpeer_list, c, log_link);
+ TAILQ_INSERT_HEAD(&perpeer_list, c, log_link);
passert(c->log_file != NULL);
perpeer_count++;
}
@@ -406,8 +406,8 @@ peerlog(const char *prefix, const char *m)
fprintf(cur_connection->log_file, "%s %s%s\n", datebuf, prefix, m);
/* now move it to the front of the list */
- CIRCLEQ_REMOVE(&perpeer_list, cur_connection, log_link);
- CIRCLEQ_INSERT_HEAD(&perpeer_list, cur_connection, log_link);
+ TAILQ_REMOVE(&perpeer_list, cur_connection, log_link);
+ TAILQ_INSERT_HEAD(&perpeer_list, cur_connection, log_link);
}
}