diff --git a/compel/test/fdspy/spy.c b/compel/test/fdspy/spy.c index c6558f079..bbb9eb418 100644 --- a/compel/test/fdspy/spy.c +++ b/compel/test/fdspy/spy.c @@ -104,8 +104,14 @@ static int check_pipe_ends(int wfd, int rfd) } printf("Check pipe ends are connected\n"); - write(wfd, "1", 2); - read(rfd, aux, sizeof(aux)); + if (write(wfd, "1", 2) != 2) { + fprintf(stderr, "write to pipe failed\n"); + return -1; + } + if (read(rfd, aux, sizeof(aux)) != sizeof(aux)) { + fprintf(stderr, "read from pipe failed\n"); + return -1; + } if (aux[0] != '1' || aux[1] != '\0') { fprintf(stderr, "Pipe connectivity lost\n"); return 0; diff --git a/compel/test/rsys/spy.c b/compel/test/rsys/spy.c index 6ccb2a502..dd89005f1 100644 --- a/compel/test/rsys/spy.c +++ b/compel/test/rsys/spy.c @@ -64,7 +64,9 @@ static inline int chk(int fd, int val) { int v = 0; - read(fd, &v, sizeof(v)); + if (read(fd, &v, sizeof(v)) != sizeof(v)) { + fprintf(stderr, "read failed\n"); + } printf("%d, want %d\n", v, val); return v == val; } @@ -97,7 +99,10 @@ int main(int argc, char **argv) * Kick the victim once */ i = 0; - write(p_in[1], &i, sizeof(i)); + if (write(p_in[1], &i, sizeof(i)) != sizeof(i)) { + fprintf(stderr, "write to pipe failed\n"); + return -1; + } printf("Checking the victim session to be %d\n", sid); pass = chk(p_out[0], sid); @@ -115,7 +120,10 @@ int main(int argc, char **argv) /* * Kick the victim again so it tells new session */ - write(p_in[1], &i, sizeof(i)); + if (write(p_in[1], &i, sizeof(i)) != sizeof(i)) { + fprintf(stderr, "write to pipe failed\n"); + return -1; + } /* * Stop the victim and check the intrusion went well diff --git a/compel/test/rsys/victim.c b/compel/test/rsys/victim.c index 2f1943d0c..85cb7cb89 100644 --- a/compel/test/rsys/victim.c +++ b/compel/test/rsys/victim.c @@ -9,7 +9,8 @@ int main(int argc, char **argv) break; i = getsid(0); - write(1, &i, sizeof(i)); + if (write(1, &i, sizeof(i)) != sizeof(i)) + break; } return 0;