Module Name: src
Committed By: christos
Date: Sat Nov 9 18:58:22 UTC 2013
Modified Files:
src/usr.sbin/syslogd: syslogd.c
Log Message:
fix two bugs related to queues (Anthony Mallet)
- the default values are in humanized number form so strtol does not work
- fix reversed size tests
To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/usr.sbin/syslogd/syslogd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.sbin/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.115 src/usr.sbin/syslogd/syslogd.c:1.116
--- src/usr.sbin/syslogd/syslogd.c:1.115 Mon May 27 19:15:51 2013
+++ src/usr.sbin/syslogd/syslogd.c Sat Nov 9 13:58:22 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: syslogd.c,v 1.115 2013/05/27 23:15:51 christos Exp $ */
+/* $NetBSD: syslogd.c,v 1.116 2013/11/09 18:58:22 christos Exp $ */
/*
* Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
#if 0
static char sccsid[] = "@(#)syslogd.c 8.3 (Berkeley) 4/4/94";
#else
-__RCSID("$NetBSD: syslogd.c,v 1.115 2013/05/27 23:15:51 christos Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.116 2013/11/09 18:58:22 christos Exp $");
#endif
#endif /* not lint */
@@ -3143,13 +3143,13 @@ read_config_file(FILE *cf, struct filed
if (!TypeInfo[i].queue_length_string
|| dehumanize_number(TypeInfo[i].queue_length_string,
&TypeInfo[i].queue_length) == -1)
- TypeInfo[i].queue_length = strtol(
- TypeInfo[i].default_length_string, NULL, 10);
+ dehumanize_number(TypeInfo[i].default_length_string,
+ &TypeInfo[i].queue_length);
if (!TypeInfo[i].queue_size_string
|| dehumanize_number(TypeInfo[i].queue_size_string,
&TypeInfo[i].queue_size) == -1)
- TypeInfo[i].queue_size = strtol(
- TypeInfo[i].default_size_string, NULL, 10);
+ dehumanize_number(TypeInfo[i].default_size_string,
+ &TypeInfo[i].queue_size);
}
#ifndef DISABLE_SIGN
@@ -4366,9 +4366,9 @@ message_queue_purge(struct filed *f, siz
while (removed < del_entries
|| (TypeInfo[f->f_type].queue_length != -1
- && (size_t)TypeInfo[f->f_type].queue_length > f->f_qelements)
+ && (size_t)TypeInfo[f->f_type].queue_length <= f->f_qelements)
|| (TypeInfo[f->f_type].queue_size != -1
- && (size_t)TypeInfo[f->f_type].queue_size > f->f_qsize)) {
+ && (size_t)TypeInfo[f->f_type].queue_size <= f->f_qsize)) {
qentry = find_qentry_to_delete(&f->f_qhead, strategy, 0);
if (message_queue_remove(f, qentry))
removed++;