set LOG_PERROR for openlog() when running foreground.

Obtained from:	KAME
MFC after:	1 week
This commit is contained in:
Hajimu UMEMOTO 2003-08-15 17:15:10 +00:00
parent 767b3bfd66
commit fbcc332a1d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118959

View File

@ -158,12 +158,10 @@ main(argc, argv)
#endif
struct timeval *timeout;
int i, ch;
int fflag = 0;
int fflag = 0, logopt;
FILE *pidfp;
pid_t pid;
openlog("rtadvd", LOG_NDELAY|LOG_PID, LOG_DAEMON);
/* get command line options and arguments */
while ((ch = getopt(argc, argv, "c:dDfM:Rs")) != -1) {
switch (ch) {
@ -202,6 +200,11 @@ main(argc, argv)
exit(1);
}
logopt = LOG_NDELAY | LOG_PID;
if (fflag)
logopt |= LOG_PERROR;
openlog("rtadvd", logopt, LOG_DAEMON);
/* set log level */
if (dflag == 0)
(void)setlogmask(LOG_UPTO(LOG_ERR));
@ -228,6 +231,7 @@ main(argc, argv)
fprintf(stderr, "fatal: inet_pton failed\n");
exit(1);
}
if (!fflag)
daemon(1, 0);