From c06e8baa7e2ce193196b2b7a8e6036eec90ce7c8 Mon Sep 17 00:00:00 2001 From: Michael Rash Date: Tue, 11 Oct 2016 23:04:25 -0400 Subject: [PATCH] [client] exit() upon execvpe() error for wget execution --- client/http_resolve_host.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/client/http_resolve_host.c b/client/http_resolve_host.c index fb9d7c36..32473e34 100644 --- a/client/http_resolve_host.c +++ b/client/http_resolve_host.c @@ -334,7 +334,7 @@ resolve_ip_https(fko_cli_options_t *options) int pipe_fd[2]; pid_t pid=0; FILE *output; - int status; + int status, es = 0; #else FILE *wget; #endif @@ -434,7 +434,18 @@ resolve_ip_https(fko_cli_options_t *options) close(pipe_fd[0]); dup2(pipe_fd[1], STDOUT_FILENO); dup2(pipe_fd[1], STDERR_FILENO); - execvpe(wget_argv[0], wget_argv, (char * const *)NULL); /* don't use env */ + es = execvpe(wget_argv[0], wget_argv, (char * const *)NULL); /* don't use env */ + + if(es == -1) + log_msg(LOG_VERBOSITY_ERROR, + "[*] resolve_ip_https(): execvpe() failed: %s", + strerror(errno)); + + /* We only make it here if there was a problem with execvpe(), + * so exit() here either way to not leave another fwknopd process + * running after fork(). + */ + exit(es); } else if(pid == -1) {