summaryrefslogtreecommitdiffstats
path: root/usr.sbin/syslogd/syslogd.c
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2016-01-13 17:56:30 -0200
committerRenato Botelho <renato@netgate.com>2016-01-13 17:56:30 -0200
commit3e0bf52f358eb969d165c4b1e54942ee94cf2c8d (patch)
tree440bb9907871a5bc578d65b32f0c4aa339096175 /usr.sbin/syslogd/syslogd.c
parent4b4ac714f11471e43f18410bcc86da8f9dc3b88c (diff)
parente357bdb742b2696dcb81404917b6247f9e840232 (diff)
downloadFreeBSD-src-3e0bf52f358eb969d165c4b1e54942ee94cf2c8d.zip
FreeBSD-src-3e0bf52f358eb969d165c4b1e54942ee94cf2c8d.tar.gz
Merge remote-tracking branch 'origin/stable/10' into devel
Diffstat (limited to 'usr.sbin/syslogd/syslogd.c')
-rw-r--r--usr.sbin/syslogd/syslogd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/syslogd/syslogd.c b/usr.sbin/syslogd/syslogd.c
index ec1bd3c..4afec2d 100644
--- a/usr.sbin/syslogd/syslogd.c
+++ b/usr.sbin/syslogd/syslogd.c
@@ -282,6 +282,7 @@ static struct filed *Files; /* Log files that we write to */
static struct filed consfile; /* Console */
static int Debug; /* debug flag */
+static int Foreground = 0; /* Run in foreground, instead of daemonizing */
static int resolve = 1; /* resolve hostname */
static char LocalHostName[MAXHOSTNAMELEN]; /* our hostname */
static const char *LocalDomain; /* our local domain name */
@@ -385,7 +386,7 @@ main(int argc, char *argv[])
dprintf("madvise() failed: %s\n", strerror(errno));
bindhostname = NULL;
- while ((ch = getopt(argc, argv, "468Aa:b:cCdf:kl:m:nNop:P:sS:Tuv"))
+ while ((ch = getopt(argc, argv, "468Aa:b:cCdf:Fkl:m:nNop:P:sS:Tuv"))
!= -1)
switch (ch) {
case '4':
@@ -421,6 +422,9 @@ main(int argc, char *argv[])
case 'f': /* configuration file */
ConfFile = optarg;
break;
+ case 'F': /* run in foreground instead of daemon */
+ Foreground++;
+ break;
case 'k': /* keep remote kern fac */
KeepKernFac = 1;
break;
@@ -512,14 +516,14 @@ main(int argc, char *argv[])
warn("cannot open pid file");
}
- if (!Debug) {
+ if ((!Foreground) && (!Debug)) {
ppid = waitdaemon(0, 0, 30);
if (ppid < 0) {
warn("could not become daemon");
pidfile_remove(pfh);
exit(1);
}
- } else {
+ } else if (Debug) {
setlinebuf(stdout);
}
@@ -739,7 +743,7 @@ usage(void)
{
fprintf(stderr, "%s\n%s\n%s\n%s\n",
- "usage: syslogd [-468ACcdknosTuv] [-a allowed_peer]",
+ "usage: syslogd [-468ACcdFknosTuv] [-a allowed_peer]",
" [-b bind_address] [-f config_file]",
" [-l [mode:]path] [-m mark_interval]",
" [-P pid_file] [-p log_socket]");
OpenPOWER on IntegriCloud