From: Nikos Mavrogiannopoulos Date: Thu, 12 Nov 2020 14:36:06 +0000 (+0100) Subject: run_hip_script: made error handling consistent X-Git-Tag: v8.20~386^2~16 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=2f643644964d90fe8ec0d5bcce25cfa997c16733;p=users%2Fdwmw2%2Fopenconnect.git run_hip_script: made error handling consistent Signed-off-by: Nikos Mavrogiannopoulos --- diff --git a/gpst.c b/gpst.c index 686bde2b..27397af6 100644 --- a/gpst.c +++ b/gpst.c @@ -909,14 +909,17 @@ static int run_hip_script(struct openconnect_info *vpninfo) if (pipe2(pipefd, O_CLOEXEC)) #endif { - if (pipe(pipefd)) - goto out; + if (pipe(pipefd)) { + vpn_progress(vpninfo, PRG_ERR, _("Failed to create pipe for HIP script\n")); + return -EPERM; + } set_fd_cloexec(pipefd[0]); set_fd_cloexec(pipefd[1]); } child = fork(); if (child == -1) { - goto out; + vpn_progress(vpninfo, PRG_ERR, _("Failed to fork for HIP script\n")); + return -EPERM; } else if (child > 0) { /* in parent: read report from child */ struct oc_text_buf *report_buf = buf_alloc(); @@ -979,7 +982,6 @@ static int run_hip_script(struct openconnect_info *vpninfo) hip_argv[i++] = NULL; execv(hip_argv[0], (char **)hip_argv); - out: vpn_progress(vpninfo, PRG_ERR, _("Failed to exec HIP script %s\n"), hip_argv[0]); exit(1);