Permalink
Browse files

Avoid printing %s,NULL in case of errors we do not expect.

Fixes #2879
  • Loading branch information...
bsdphk committed Jan 11, 2019
1 parent 708cec8 commit 7119d790b590e7fb560ad602cedfda5185c7e841
Showing with 11 additions and 9 deletions.
  1. +11 −9 lib/libvarnish/vnum.c
@@ -349,15 +349,17 @@ main(int argc, char *argv[])

for (tc = test_cases; tc->str; ++tc) {
e = VNUM_2bytes(tc->str, &val, tc->rel);
if (e != tc->err) {
printf("%s: VNUM_2bytes(\"%s\", %ju) (%s) != (%s)\n",
*argv, tc->str, tc->rel, tc->err, e);
++ec;
} else if (e == NULL && val != tc->val) {
printf("%s: VNUM_2bytes(\"%s\", %ju) %ju != %ju (%s)\n",
*argv, tc->str, tc->rel, val, tc->val, e);
++ec;
}
if (e != NULL)
val = 0;
if (e == tc->err && val == tc->val)
continue;
++ec;
printf("%s: VNUM_2bytes(\"%s\", %ju)\n",
*argv, tc->str, tc->rel);
printf("\tExpected:\tstatus %s - value %ju\n",
tc->err ? tc->err : "Success", tc->val);
printf("\tGot:\t\tstatus %s - value %ju\n",
e ? e : "Success", val);
}
if (!isnan(VNUM_duration(NULL))) {
printf("%s: VNUM_Duration(NULL) fail\n", *argv);

0 comments on commit 7119d79

Please sign in to comment.