From bb942cee00c5ed66e4847f37ea9881379a95ad2f Mon Sep 17 00:00:00 2001 From: Lukas Slebodnik Date: Jul 21 2018 21:26:49 +0000 Subject: test_ssh_client: Do not ignore failure from read Merges: https://pagure.io/SSSD/sssd/pull-request/3782 --- diff --git a/src/tests/test_ssh_client.c b/src/tests/test_ssh_client.c index 8f96394..8901ef6 100644 --- a/src/tests/test_ssh_client.c +++ b/src/tests/test_ssh_client.c @@ -42,6 +42,7 @@ int main(int argc, const char *argv[]) const char *pc_user = NULL; char *av[3]; char buf[5]; /* Ridiculously small buffer by design */ + ssize_t len; /* Set debug level to invalid value so we can decide if -d 0 was used. */ debug_level = SSSDBG_INVALID; @@ -111,8 +112,12 @@ int main(int argc, const char *argv[]) } close(p[1]); - read(p[0], buf, sizeof(buf)); + len = read(p[0], buf, sizeof(buf)); close(p[0]); + if (len == -1) { + perror("waitpid"); + return 3; + } pid = waitpid(pid, &status, 0); if (pid == -1) {