From 4bf8ee803282b9d2f6ea11770bab8b8407116b3a Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 5 Feb 2011 11:26:54 +0100 Subject: [PATCH] tests: Check fgets output. --- tests/client/torture_knownhosts.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/client/torture_knownhosts.c b/tests/client/torture_knownhosts.c index 8f9db8ee..ed1f3116 100644 --- a/tests/client/torture_knownhosts.c +++ b/tests/client/torture_knownhosts.c @@ -47,6 +47,7 @@ static void teardown(void **state) { static void torture_knownhosts_port(void **state) { ssh_session session = *state; char buffer[200]; + char *p; FILE *file; int rc; @@ -69,7 +70,8 @@ static void torture_knownhosts_port(void **state) { file = fopen(KNOWNHOSTFILES, "r"); assert_true(file != NULL); - fgets(buffer, sizeof(buffer), file); + p = fgets(buffer, sizeof(buffer), file); + assert_false(p == NULL) fclose(file); buffer[sizeof(buffer) - 1] = '\0'; assert_true(strstr(buffer,"[localhost]:1234 ") != NULL);