projects
/
apps
/
pfixtools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Port strlist to use async DNS.
[apps/pfixtools.git]
/
postlicyd
/
tst-filters.c
diff --git
a/postlicyd/tst-filters.c
b/postlicyd/tst-filters.c
index
52f22a4
..
9de410c
100644
(file)
--- a/
postlicyd/tst-filters.c
+++ b/
postlicyd/tst-filters.c
@@
-38,10
+38,6
@@
#include "file.h"
#include <dirent.h>
#include "file.h"
#include <dirent.h>
-#define DAEMON_NAME "tst-filters"
-
-DECLARE_MAIN
-
static char *read_query(const char *basepath, const char *filename,
char *buff, char **end, query_t *q)
{
static char *read_query(const char *basepath, const char *filename,
char *buff, char **end, query_t *q)
{
@@
-54,7
+50,7
@@
static char *read_query(const char *basepath, const char *filename,
return NULL;
}
if (map.end - map.map >= BUFSIZ) {
return NULL;
}
if (map.end - map.map >= BUFSIZ) {
-
syslog(LOG_ERR,
"File too large for a testcase: %s", path);
+
err(
"File too large for a testcase: %s", path);
file_map_close(&map);
return NULL;
}
file_map_close(&map);
return NULL;
}
@@
-62,6
+58,8
@@
static char *read_query(const char *basepath, const char *filename,
if (end != NULL) {
*end = buff + (map.end - map.map);
**end = '\0';
if (end != NULL) {
*end = buff + (map.end - map.map);
**end = '\0';
+ } else {
+ buff[map.end - map.map] = '\0';
}
file_map_close(&map);
}
}
file_map_close(&map);
}
@@
-71,7
+69,7
@@
static char *read_query(const char *basepath, const char *filename,
return NULL;
}
if (!query_parse(q, buff)) {
return NULL;
}
if (!query_parse(q, buff)) {
-
syslog(LOG_ERR,
"Cannot parse query from file %s", filename);
+
err(
"Cannot parse query from file %s", filename);
return NULL;
}
return eoq + 2;
return NULL;
}
return eoq + 2;
@@
-98,21
+96,21
@@
static bool run_testcase(const config_t *config, const char *basepath,
char *sep = memchr(eol, '=', neol - eol);
if (sep == NULL) {
eol = neol + 1;
char *sep = memchr(eol, '=', neol - eol);
if (sep == NULL) {
eol = neol + 1;
-
syslog(LOG_ERR,
"missing separator");
+
err(
"missing separator");
continue;
}
*sep = '\0';
int pos = filter_find_with_name(&config->filters, eol);
if (pos == -1) {
continue;
}
*sep = '\0';
int pos = filter_find_with_name(&config->filters, eol);
if (pos == -1) {
-
syslog(LOG_ERR,
"Unknown filter %s", eol);
+
err(
"Unknown filter %s", eol);
eol = neol + 1;
continue;
}
++sep;
filter_result_t result = hook_tokenize(sep, neol - sep);
if (result == HTK_UNKNOWN) {
eol = neol + 1;
continue;
}
++sep;
filter_result_t result = hook_tokenize(sep, neol - sep);
if (result == HTK_UNKNOWN) {
-
syslog(LOG_ERR,
"Unknown filter result %.*s", neol - sep, sep);
+
err(
"Unknown filter result %.*s", neol - sep, sep);
eol = neol + 1;
continue;
}
eol = neol + 1;
continue;
}
@@
-187,6
+185,7
@@
int main(int argc, char *argv[])
char path[FILENAME_MAX];
char *p;
char path[FILENAME_MAX];
char *p;
+ common_startup();
p = strrchr(argv[0], '/');
if (p == NULL) {
p = argv[0];
p = strrchr(argv[0], '/');
if (p == NULL) {
p = argv[0];
@@
-239,6
+238,5
@@
int main(int argc, char *argv[])
#undef RUN
#undef RUN
- config_delete(&config);
return 0;
}
return 0;
}