mirror of
https://github.com/omar-polo/gmid.git
synced 2024-09-30 22:41:15 +02:00
remove foreground / verbose from config
set them as global vars; rename foreground -> debug
This commit is contained in:
parent
85a575a444
commit
ca84625a7f
15
gmid.c
15
gmid.c
@ -66,6 +66,8 @@ int sock4, sock6;
|
|||||||
int privsep_process;
|
int privsep_process;
|
||||||
int pidfd = -1;
|
int pidfd = -1;
|
||||||
|
|
||||||
|
int debug, verbose;
|
||||||
|
|
||||||
const char *config_path = "/etc/gmid.conf";
|
const char *config_path = "/etc/gmid.conf";
|
||||||
const char *pidfile;
|
const char *pidfile;
|
||||||
|
|
||||||
@ -193,7 +195,7 @@ main(int argc, char **argv)
|
|||||||
optarg);
|
optarg);
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
conf.foreground = 1;
|
debug = 1;
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
usage();
|
usage();
|
||||||
@ -220,7 +222,7 @@ main(int argc, char **argv)
|
|||||||
puts("Version: " GMID_STRING);
|
puts("Version: " GMID_STRING);
|
||||||
return 0;
|
return 0;
|
||||||
case 'v':
|
case 'v':
|
||||||
conf.verbose++;
|
verbose = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
usage();
|
usage();
|
||||||
@ -263,17 +265,16 @@ main(int argc, char **argv)
|
|||||||
procs[i].p_chroot = conf.chroot;
|
procs[i].p_chroot = conf.chroot;
|
||||||
}
|
}
|
||||||
|
|
||||||
log_init(conf.foreground, LOG_DAEMON);
|
log_init(debug, LOG_DAEMON);
|
||||||
log_setverbose(conf.verbose);
|
log_setverbose(verbose);
|
||||||
if (title != NULL)
|
if (title != NULL)
|
||||||
log_procinit(title);
|
log_procinit(title);
|
||||||
|
|
||||||
/* only the parent returns */
|
/* only the parent returns */
|
||||||
proc_init(ps, procs, nitems(procs), conf.foreground,
|
proc_init(ps, procs, nitems(procs), debug, argc0, argv, proc_id);
|
||||||
argc0, argv, proc_id);
|
|
||||||
|
|
||||||
log_procinit("main");
|
log_procinit("main");
|
||||||
if (!conf.foreground && daemon(0, 0) == -1)
|
if (!debug && daemon(0, 0) == -1)
|
||||||
fatal("daemon");
|
fatal("daemon");
|
||||||
|
|
||||||
pidfd = write_pidfile(pidfile);
|
pidfd = write_pidfile(pidfile);
|
||||||
|
Loading…
Reference in New Issue
Block a user