1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-05-30 05:24:50 +03:00

tests: Check return value of stat.

This commit is contained in:
Andreas Schneider 2013-06-18 17:11:34 +02:00
parent 485e3b4014
commit 68be73ec0d

View File

@ -85,12 +85,14 @@ static char *read_file(const char *filename) {
char *key;
int fd;
int size;
int rc;
struct stat buf;
assert_true(filename != NULL);
assert_true(*filename != '\0');
stat(filename, &buf);
rc = stat(filename, &buf);
assert_int_equal(rc, 0);
key = malloc(buf.st_size + 1);
assert_true(key != NULL);