aboutsummaryrefslogtreecommitdiff
path: root/gmid.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2023-06-08 17:29:08 +0000
committerOmar Polo <op@omarpolo.com>2023-06-08 17:29:08 +0000
commitca84625a7f59c0c6816cc101c975c134660946f8 (patch)
treee251eff4ca04ab2541e5e1b017b047137826f3ab /gmid.c
parent85a575a444f08cf40de0eb553500b79b7a644a0f (diff)
remove foreground / verbose from config
set them as global vars; rename foreground -> debug
Diffstat (limited to 'gmid.c')
-rw-r--r--gmid.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/gmid.c b/gmid.c
index 87330e4..a03ccbb 100644
--- a/gmid.c
+++ b/gmid.c
@@ -66,6 +66,8 @@ int sock4, sock6;
int privsep_process;
int pidfd = -1;
+int debug, verbose;
+
const char *config_path = "/etc/gmid.conf";
const char *pidfile;
@@ -193,7 +195,7 @@ main(int argc, char **argv)
optarg);
break;
case 'f':
- conf.foreground = 1;
+ debug = 1;
break;
case 'h':
usage();
@@ -220,7 +222,7 @@ main(int argc, char **argv)
puts("Version: " GMID_STRING);
return 0;
case 'v':
- conf.verbose++;
+ verbose = 1;
break;
default:
usage();
@@ -263,17 +265,16 @@ main(int argc, char **argv)
procs[i].p_chroot = conf.chroot;
}
- log_init(conf.foreground, LOG_DAEMON);
- log_setverbose(conf.verbose);
+ log_init(debug, LOG_DAEMON);
+ log_setverbose(verbose);
if (title != NULL)
log_procinit(title);
/* only the parent returns */
- proc_init(ps, procs, nitems(procs), conf.foreground,
- argc0, argv, proc_id);
+ proc_init(ps, procs, nitems(procs), debug, argc0, argv, proc_id);
log_procinit("main");
- if (!conf.foreground && daemon(0, 0) == -1)
+ if (!debug && daemon(0, 0) == -1)
fatal("daemon");
pidfd = write_pidfile(pidfile);