summaryrefslogtreecommitdiff
path: root/usr.sbin/rad
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2021-01-19 16:53:28 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2021-01-19 16:53:28 +0000
commit116fed5a0ca2c4901ba99f48131dc424e0d11faa (patch)
tree0abedbc8bfc0375ebd95cebdb0fb72020ae080a3 /usr.sbin/rad
parente5fef487bf02adca8061f36f29962a06a725e35d (diff)
No need for a global rad_process; unbreaks -fno-common.
Problem reported by mortimer
Diffstat (limited to 'usr.sbin/rad')
-rw-r--r--usr.sbin/rad/engine.c7
-rw-r--r--usr.sbin/rad/frontend.c7
-rw-r--r--usr.sbin/rad/rad.c15
-rw-r--r--usr.sbin/rad/rad.h14
4 files changed, 17 insertions, 26 deletions
diff --git a/usr.sbin/rad/engine.c b/usr.sbin/rad/engine.c
index 23967f6d2bb..ef8506c1b7f 100644
--- a/usr.sbin/rad/engine.c
+++ b/usr.sbin/rad/engine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: engine.c,v 1.16 2020/05/20 10:37:02 claudio Exp $ */
+/* $OpenBSD: engine.c,v 1.17 2021/01/19 16:53:27 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -105,9 +105,8 @@ engine(int debug, int verbose)
if (chdir("/") == -1)
fatal("chdir(\"/\")");
- rad_process = PROC_ENGINE;
- setproctitle("%s", log_procnames[rad_process]);
- log_procinit(log_procnames[rad_process]);
+ setproctitle("%s", "engine");
+ log_procinit("engine");
if (setgroups(1, &pw->pw_gid) ||
setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) ||
diff --git a/usr.sbin/rad/frontend.c b/usr.sbin/rad/frontend.c
index c883e2296b7..4ef2b13a070 100644
--- a/usr.sbin/rad/frontend.c
+++ b/usr.sbin/rad/frontend.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: frontend.c,v 1.36 2021/01/18 15:20:28 florian Exp $ */
+/* $OpenBSD: frontend.c,v 1.37 2021/01/19 16:53:27 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -198,9 +198,8 @@ frontend(int debug, int verbose)
if (chdir("/") == -1)
fatal("chdir(\"/\")");
- rad_process = PROC_FRONTEND;
- setproctitle("%s", log_procnames[rad_process]);
- log_procinit(log_procnames[rad_process]);
+ setproctitle("%s", "frontend");
+ log_procinit("frontend");
if (setgroups(1, &pw->pw_gid) ||
setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) ||
diff --git a/usr.sbin/rad/rad.c b/usr.sbin/rad/rad.c
index eb59ae15ac1..0b578c24818 100644
--- a/usr.sbin/rad/rad.c
+++ b/usr.sbin/rad/rad.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rad.c,v 1.24 2020/12/01 17:31:37 florian Exp $ */
+/* $OpenBSD: rad.c,v 1.25 2021/01/19 16:53:27 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -52,12 +52,18 @@
#include "engine.h"
#include "control.h"
+enum rad_process {
+ PROC_MAIN,
+ PROC_ENGINE,
+ PROC_FRONTEND
+};
+
__dead void usage(void);
__dead void main_shutdown(void);
void main_sig_handler(int, short, void *);
-static pid_t start_child(int, char *, int, int, int);
+static pid_t start_child(enum rad_process, char *, int, int, int);
void main_dispatch_frontend(int, short, void *);
void main_dispatch_engine(int, short, void *);
@@ -221,8 +227,7 @@ main(int argc, char *argv[])
frontend_pid = start_child(PROC_FRONTEND, saved_argv0,
pipe_main2frontend[1], debug, cmd_opts & OPT_VERBOSE);
- rad_process = PROC_MAIN;
- log_procinit(log_procnames[rad_process]);
+ log_procinit("main");
event_init();
@@ -325,7 +330,7 @@ main_shutdown(void)
}
static pid_t
-start_child(int p, char *argv0, int fd, int debug, int verbose)
+start_child(enum rad_process p, char *argv0, int fd, int debug, int verbose)
{
char *argv[6];
int argc = 0;
diff --git a/usr.sbin/rad/rad.h b/usr.sbin/rad/rad.h
index 92368e50022..fb6565bc6a6 100644
--- a/usr.sbin/rad/rad.h
+++ b/usr.sbin/rad/rad.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rad.h,v 1.19 2020/12/01 17:31:37 florian Exp $ */
+/* $OpenBSD: rad.h,v 1.20 2021/01/19 16:53:27 florian Exp $ */
/*
* Copyright (c) 2018 Florian Obser <florian@openbsd.org>
@@ -36,18 +36,6 @@
#define IMSG_DATA_SIZE(imsg) ((imsg).hdr.len - IMSG_HEADER_SIZE)
-enum {
- PROC_MAIN,
- PROC_ENGINE,
- PROC_FRONTEND
-} rad_process;
-
-static const char * const log_procnames[] = {
- "main",
- "engine",
- "frontend",
-};
-
struct imsgev {
struct imsgbuf ibuf;
void (*handler)(int, short, void *);