commit 37f85ed663b884e42223a00261bd5dc61a4cb50f
parent 599617e7b40713c68b2ae4f9a1730e21172ef457
Author: Joris Vink <joris@coders.se>
Date: Mon, 11 Jan 2021 23:35:16 +0100
rename foreground to kore_foreground.
Diffstat:
4 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/include/kore/kore.h b/include/kore/kore.h
@@ -692,11 +692,12 @@ extern char *config_file;
#endif
extern pid_t kore_pid;
-extern int foreground;
extern int kore_quiet;
extern int kore_debug;
extern int skip_chroot;
extern int skip_runas;
+extern int kore_foreground;
+
extern char *kore_pidfile;
extern char *kore_root_path;
extern char *kore_runas_user;
diff --git a/src/config.c b/src/config.c
@@ -1858,11 +1858,11 @@ static int
configure_deployment(char *value)
{
if (!strcmp(value, "dev") || !strcmp(value, "development")) {
- foreground = 1;
+ kore_foreground = 1;
skip_runas = 1;
skip_chroot = 1;
} else if (!strcmp(value, "production")) {
- foreground = 0;
+ kore_foreground = 0;
skip_runas = 0;
skip_chroot = 0;
} else {
diff --git a/src/kore.c b/src/kore.c
@@ -55,13 +55,13 @@ u_int8_t nlisteners;
int kore_argc = 0;
pid_t kore_pid = -1;
u_int16_t cpu_count = 1;
-int foreground = 0;
int kore_debug = 0;
int kore_quiet = 0;
int skip_runas = 0;
int skip_chroot = 0;
u_int8_t worker_count = 0;
char **kore_argv = NULL;
+int kore_foreground = 0;
char *kore_progname = NULL;
char *kore_root_path = NULL;
char *kore_runas_user = NULL;
@@ -326,7 +326,7 @@ kore_default_getopt(int argc, char **argv)
break;
#endif
case 'f':
- foreground = 1;
+ kore_foreground = 1;
break;
case 'h':
usage();
@@ -737,7 +737,7 @@ kore_signal_setup(void)
if (sigaction(SIGCHLD, &sa, NULL) == -1)
fatal("sigaction: %s", errno_s);
- if (foreground) {
+ if (kore_foreground) {
if (sigaction(SIGINT, &sa, NULL) == -1)
fatal("sigaction: %s", errno_s);
} else {
@@ -837,7 +837,7 @@ kore_server_start(int argc, char *argv[])
struct kore_runtime_call *rcall;
#endif
- if (foreground == 0) {
+ if (kore_foreground == 0) {
if (daemon(1, 0) == -1)
fatal("cannot daemon(): %s", errno_s);
#if defined(KORE_SINGLE_BINARY)
diff --git a/src/utils.c b/src/utils.c
@@ -89,7 +89,7 @@ kore_log_init(void)
const char *name = "kore";
#endif
- if (!foreground)
+ if (!kore_foreground)
openlog(name, LOG_NDELAY | LOG_PID, LOG_DAEMON);
}
@@ -107,12 +107,12 @@ kore_log(int prio, const char *fmt, ...)
if (worker != NULL) {
name = kore_worker_name(worker->id);
- if (foreground)
+ if (kore_foreground)
printf("%s: %s\n", name, buf);
else
syslog(prio, "%s: %s", name, buf);
} else {
- if (foreground)
+ if (kore_foreground)
printf("[parent]: %s\n", buf);
else
syslog(prio, "[parent]: %s", buf);
@@ -693,7 +693,7 @@ fatal_log(const char *fmt, va_list args)
(void)vsnprintf(buf, sizeof(buf), fmt, args);
- if (!foreground)
+ if (!kore_foreground)
kore_log(LOG_ERR, "%s", buf);
if (worker != NULL && worker->id == KORE_WORKER_KEYMGR)