From bd8ced55f122d150224466d6abf8b4ccd3605f8e Mon Sep 17 00:00:00 2001 From: Giacomo Tesio Date: Thu, 4 May 2017 00:22:50 +0200 Subject: [PATCH] qa: fix CID 168327 and CID 168326 --- qa/lib/newlib/200-signals.c | 5 ++++- qa/lib/newlib/201-signals.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/qa/lib/newlib/200-signals.c b/qa/lib/newlib/200-signals.c index 954f9cc..6b31d87 100644 --- a/qa/lib/newlib/200-signals.c +++ b/qa/lib/newlib/200-signals.c @@ -38,7 +38,10 @@ main() { else /* parent */ { close(p[1]); - read(p[0], &dummy, 1); + if(read(p[0], &dummy, 1) > 0){ + printf("sync read received data"); + exit(EXIT_FAILURE); + } close(p[0]); printf("\nPARENT: sending SIGHUP\n\n"); kill(pid,SIGHUP); diff --git a/qa/lib/newlib/201-signals.c b/qa/lib/newlib/201-signals.c index 152cea9..0a90039 100644 --- a/qa/lib/newlib/201-signals.c +++ b/qa/lib/newlib/201-signals.c @@ -33,7 +33,10 @@ main() { else /* parent */ { close(p[1]); - read(p[0], &dummy, 1); + if(read(p[0], &dummy, 1) > 0){ + printf("sync read received data"); + exit(EXIT_FAILURE); + } close(p[0]); printf("\nPARENT: sending SIGQUIT\n\n"); kill(pid,SIGQUIT);