tttm

git clone https://orangeshoelaces.net/git/tttm.git

06196f084c0536e00be9808f885230c3d3b27cb8

Author: Vasily Kolobkov on 06/03/2016

Committer: Vasily Kolobkov on 06/03/2016

Fix processing sink termination

Stats

tttm.c | 14 +++++---
1 file changed, 10 insertions(+), 4 deletions(-)

Patch

diff --git a/tttm.c b/tttm.c
index 3e4029a..80105e5 100644
--- a/tttm.c
+++ b/tttm.c
@@ -264,10 +264,16 @@ sink_free(pid_t sid, int in)
 	}
 	if (waitpid(sid, &s, 0) == -1) {
 		warn("failed to randezvous with sink");
-	} else if (!WIFEXITED(s)) {
-		warn("sink process terminated");
-	} else if (WEXITSTATUS(s)) {
-		warn("sink process failed (%d)", (int)WEXITSTATUS(s));
+		goto exit;
+	}
+	if (!WIFEXITED(s)) {
+		warnx("sink process terminated");
+		goto exit;
+	}
+	if (WEXITSTATUS(s)) {
+		warnx("sink process failed with exit satus %d",
+		    (int)WEXITSTATUS(s));
+		goto exit;
 	}
 	e = 0;
  exit: