INN commit: trunk/innd (cc.c)
INN Commit
rra at isc.org
Tue Jun 12 18:29:00 UTC 2012
Date: Tuesday, June 12, 2012 @ 11:29:00
Author: iulius
Revision: 9416
ctlinnd: check the syntax of the newsfeeds file on reload
Add a check of the syntax of the newsfeeds file when trying to reload "all",
"active" and "newsfeeds".
Otherwise, innd may crash on reload.
Thanks to Tim Fardell for the bug report.
Modified:
trunk/innd/cc.c
------+
cc.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
Modified: cc.c
===================================================================
--- cc.c 2012-06-12 17:59:28 UTC (rev 9415)
+++ cc.c 2012-06-12 18:29:00 UTC (rev 9416)
@@ -498,7 +498,7 @@
if (errors == 0)
return NULL;
- buffer_sprintf(&CCreply, false, "1 Found %d errors -- see syslog", errors);
+ buffer_sprintf(&CCreply, false, "1 Found %d error(s) -- see syslog", errors);
return CCreply.data;
}
@@ -1315,6 +1315,7 @@
CCreload(char *av[])
{
const char *p;
+ const char *error;
#ifdef DO_PERL
static char BADPERLRELOAD[] = "1 Failed to define filter_art" ;
@@ -1327,6 +1328,9 @@
p = av[0];
if (*p == '\0' || strcmp(p, "all") == 0) {
+ /* Check the syntax of the newsfeeds file before reloading. */
+ if ((error = CCcheckfile(NULL)) != NULL)
+ return error;
SITEflushall(false);
if (Mode == OMrunning)
InndHisClose();
@@ -1348,7 +1352,10 @@
p = "all";
}
else if (strcmp(p, "active") == 0 || strcmp(p, "newsfeeds") == 0) {
- SITEflushall(false);
+ /* Check the syntax of the newsfeeds file before reloading. */
+ if ((error = CCcheckfile(NULL)) != NULL)
+ return error;
+ SITEflushall(false);
ICDwrite();
ICDsetup(true);
}
@@ -1407,8 +1414,11 @@
#ifdef DO_PERL
else if (strcmp(p, "filter.perl") == 0) {
path = concatpath(innconf->pathfilter, INN_PATH_PERL_FILTER_INND);
- if (!PERLreadfilter(path, "filter_art"))
+ if (!PERLreadfilter(path, "filter_art")) {
+ free(path);
return BADPERLRELOAD;
+ }
+ free(path);
}
#endif
#ifdef DO_PYTHON
More information about the inn-committers
mailing list