mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-09-05 17:37:42 +02:00
- in testcode, free async ids, initialise array, and check for null
pointer during test of the test. And use exit for return to note irregular program stop. git-svn-id: file:///svn/unbound/trunk@4897 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
+11
-4
@@ -458,6 +458,8 @@ replay_scenario_read(FILE* in, const char* name, int* lineno)
|
||||
if(parse_keyword(&parse, ";"))
|
||||
continue; /* comment */
|
||||
if(parse_keyword(&parse, "SCENARIO_BEGIN")) {
|
||||
if(scen)
|
||||
fatal_exit("%d: double SCENARIO_BEGIN", *lineno);
|
||||
scen = make_scenario(parse);
|
||||
if(!scen)
|
||||
fatal_exit("%d: could not make scen", *lineno);
|
||||
@@ -801,14 +803,19 @@ macro_expand(rbtree_type* store, struct replay_runtime* runtime, char** text)
|
||||
|
||||
/* check for functions */
|
||||
if(strcmp(buf, "time") == 0) {
|
||||
snprintf(buf, sizeof(buf), ARG_LL "d", (long long)runtime->now_secs);
|
||||
if(runtime)
|
||||
snprintf(buf, sizeof(buf), ARG_LL "d", (long long)runtime->now_secs);
|
||||
else
|
||||
snprintf(buf, sizeof(buf), ARG_LL "d", (long long)0);
|
||||
*text += len;
|
||||
return strdup(buf);
|
||||
} else if(strcmp(buf, "timeout") == 0) {
|
||||
time_t res = 0;
|
||||
struct fake_timer* t = first_timer(runtime);
|
||||
if(t && (time_t)t->tv.tv_sec >= runtime->now_secs)
|
||||
res = (time_t)t->tv.tv_sec - runtime->now_secs;
|
||||
if(runtime) {
|
||||
struct fake_timer* t = first_timer(runtime);
|
||||
if(t && (time_t)t->tv.tv_sec >= runtime->now_secs)
|
||||
res = (time_t)t->tv.tv_sec - runtime->now_secs;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), ARG_LL "d", (long long)res);
|
||||
*text += len;
|
||||
return strdup(buf);
|
||||
|
||||
Reference in New Issue
Block a user