From db2df835da9893930a12a62b30e8893599ae540f Mon Sep 17 00:00:00 2001
From: Lukas Fleischer <calcurse@cryptocrack.de>
Date: Mon, 26 Nov 2012 20:34:36 +0100
Subject: 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>
---
 test/run-test.c | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'test')

diff --git a/test/run-test.c b/test/run-test.c
index c779be7..fb5bcb4 100644
--- a/test/run-test.c
+++ b/test/run-test.c
@@ -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)
-- 
cgit v1.2.3-70-g09d2