From 203f9cee90bb4044fa795a3d1e2bf62c916d4f37 Mon Sep 17 00:00:00 2001 From: alanbjohnston Date: Mon, 28 Dec 2020 18:24:43 -0500 Subject: [PATCH] handled errors --- afsk/main.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/afsk/main.c b/afsk/main.c index f04fc010..74aa5bee 100644 --- a/afsk/main.c +++ b/afsk/main.c @@ -1010,12 +1010,16 @@ int start_subprocess(char *const command[], int *pid, int *infd, int *outfd) if (!pid || !infd || !outfd) return 0; - if (pipe(p1) == -1) - goto err_pipe1; - if (pipe(p2) == -1) - goto err_pipe2; - if ((*pid = fork()) == -1) - goto err_fork; + if (pipe(p1) == -1) { + printf("Error pipe1\n"); + return 0; + } if (pipe(p2) == -1) { + printf("Error pipe2\n"); + return 0; + } if ((*pid = fork()) == -1) { + printf("Error fork\n"); + return 0; + } if (*pid) { /* Parent process. */