remove foreground / verbose from config

set them as global vars; rename foreground -> debug
This commit is contained in:
Omar Polo 2023-06-08 17:29:08 +00:00
parent 85a575a444
commit ca84625a7f
2 changed files with 8 additions and 9 deletions

15
gmid.c
View File

@ -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);

2
gmid.h
View File

@ -207,8 +207,6 @@ struct mime {
struct conf {
struct privsep *ps;
int foreground;
int verbose;
int port;
int ipv6;
uint32_t protos;