From 5e87fddc971210ebb6df3fe77eeb858cd0bc4dea Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Sat, 28 May 2022 18:50:18 +0200 Subject: [PATCH] apps/ocsp.c etc.: rename 'multi' to 'n_responders' for clarity Reviewed-by: Tomas Mraz Reviewed-by: Dmitry Belyavskiy Reviewed-by: David von Oheimb (Merged from https://github.com/openssl/openssl/pull/18434) --- apps/include/http_server.h | 2 +- apps/lib/http_server.c | 18 +++++++++--------- apps/ocsp.c | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/include/http_server.h b/apps/include/http_server.h index df4eba9238..e80e29d8c5 100644 --- a/apps/include/http_server.h +++ b/apps/include/http_server.h @@ -125,7 +125,7 @@ int http_server_send_status(const char *prog, BIO *cbio, # endif # ifdef HTTP_DAEMON -extern int multi; +extern int n_responders; extern int acfd; void socket_timeout(int signum); diff --git a/apps/lib/http_server.c b/apps/lib/http_server.c index ba72a6c14a..4b18e8fea4 100644 --- a/apps/lib/http_server.c +++ b/apps/lib/http_server.c @@ -41,7 +41,7 @@ static int verbosity = LOG_INFO; #ifdef HTTP_DAEMON -int multi = 0; /* run multiple responder processes, set by ocsp.c */ +int n_responders = 0; /* run multiple responder processes, set by ocsp.c */ int acfd = (int) INVALID_SOCKET; static int print_syslog(const char *str, size_t len, void *levPtr) @@ -91,7 +91,7 @@ void trace_log_message(int category, return; } #ifdef HTTP_DAEMON - if (multi != 0) { + if (n_responders != 0) { vsyslog(level, fmt, ap); if (level <= LOG_ERR) ERR_print_errors_cb(print_syslog, &level); @@ -119,7 +119,7 @@ static void killall(int ret, pid_t *kidpids) { int i; - for (i = 0; i < multi; ++i) + for (i = 0; i < n_responders; ++i) if (kidpids[i] != 0) (void)kill(kidpids[i], SIGTERM); OPENSSL_free(kidpids); @@ -153,8 +153,8 @@ void spawn_loop(const char *prog) strerror(errno)); exit(1); } - kidpids = app_malloc(multi * sizeof(*kidpids), "child PID array"); - for (i = 0; i < multi; ++i) + kidpids = app_malloc(n_responders * sizeof(*kidpids), "child PID array"); + for (i = 0; i < n_responders; ++i) kidpids[i] = 0; signal(SIGINT, noteterm); @@ -167,7 +167,7 @@ void spawn_loop(const char *prog) * Wait for a child to replace when we're at the limit. * Slow down if a child exited abnormally or waitpid() < 0 */ - while (termsig == 0 && procs >= multi) { + while (termsig == 0 && procs >= n_responders) { if ((fpid = waitpid(-1, &status, 0)) > 0) { for (i = 0; i < procs; ++i) { if (kidpids[i] == fpid) { @@ -176,7 +176,7 @@ void spawn_loop(const char *prog) break; } } - if (i >= multi) { + if (i >= n_responders) { syslog(LOG_ERR, "fatal: internal error: " "no matching child slot for pid: %ld", (long)fpid); @@ -221,14 +221,14 @@ void spawn_loop(const char *prog) } return; default: /* parent */ - for (i = 0; i < multi; ++i) { + for (i = 0; i < n_responders; ++i) { if (kidpids[i] == 0) { kidpids[i] = fpid; procs++; break; } } - if (i >= multi) { + if (i >= n_responders) { syslog(LOG_ERR, "fatal: internal error: no free child slots"); killall(1, kidpids); } diff --git a/apps/ocsp.c b/apps/ocsp.c index 297b10c861..380c6b325f 100644 --- a/apps/ocsp.c +++ b/apps/ocsp.c @@ -529,7 +529,7 @@ int ocsp_main(int argc, char **argv) break; case OPT_MULTI: #ifdef HTTP_DAEMON - multi = atoi(opt_arg()); + n_responders = atoi(opt_arg()); #endif break; case OPT_PROV_CASES: @@ -633,7 +633,7 @@ int ocsp_main(int argc, char **argv) } #ifdef HTTP_DAEMON - if (multi != 0 && acbio != NULL) + if (n_responders != 0 && acbio != NULL) spawn_loop(prog); if (acbio != NULL && req_timeout > 0) signal(SIGALRM, socket_timeout);