run-test.c: Return failure if actual output is too short

We always terminated run-test when reached the end of the expected
output and returned success if actual output and expected output were
the same up to this point. This resulted in run-test always returning
successfully if the actual output was a prefix of the expected output,
even if it was a proper prefix.

Check if the expected output contains more data after string comparison
has finished to ensure we only return successfully if both outputs are
actually equal.

Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2012-11-26 20:34:36 +01:00
parent 0715a4433c
commit db2df835da

View File

@ -183,6 +183,9 @@ static int run_test(const char *name, int expect_failure)
}
}
if (fgets(buf2, BUFSIZ, fpin2))
ret = 0;
if (fpin1)
fclose(fpin1);
if (fpin2)