mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-31 22:35:25 +00:00
Make log_perror an external; don't use LOG_PERROR - instead, do the work in errwarn.c
This commit is contained in:
27
dhcpd.c
27
dhcpd.c
@@ -41,7 +41,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static char objcopyright[] =
|
static char objcopyright[] =
|
||||||
"$Id: dhcpd.c,v 1.26 1996/08/27 09:44:54 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
|
"$Id: dhcpd.c,v 1.27 1996/08/28 01:30:19 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"Copyright 1995, 1996 The Internet Software Consortium.";
|
"Copyright 1995, 1996 The Internet Software Consortium.";
|
||||||
static char arr [] = "All rights reserved.";
|
static char arr [] = "All rights reserved.";
|
||||||
@@ -63,6 +63,7 @@ struct interface_info fallback_interface;
|
|||||||
|
|
||||||
u_int16_t server_port;
|
u_int16_t server_port;
|
||||||
int log_priority;
|
int log_priority;
|
||||||
|
int log_perror = 1;
|
||||||
|
|
||||||
int main (argc, argv, envp)
|
int main (argc, argv, envp)
|
||||||
int argc;
|
int argc;
|
||||||
@@ -76,15 +77,14 @@ int main (argc, argv, envp)
|
|||||||
int pid;
|
int pid;
|
||||||
char pbuf [20];
|
char pbuf [20];
|
||||||
int daemon = 1;
|
int daemon = 1;
|
||||||
int log_perror = 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initially, log errors to stderr as well as to syslogd. */
|
/* Initially, log errors to stderr as well as to syslogd. */
|
||||||
#ifdef SYSLOG_4_2
|
#ifdef SYSLOG_4_2
|
||||||
openlog ("dhcpd", LOG_NDELAY | LOG_PERROR);
|
openlog ("dhcpd", LOG_NDELAY);
|
||||||
log_priority = DHCPD_LOG_FACILITY;
|
log_priority = DHCPD_LOG_FACILITY;
|
||||||
#else
|
#else
|
||||||
openlog ("dhcpd", LOG_NDELAY | LOG_PERROR, DHCPD_LOG_FACILITY);
|
openlog ("dhcpd", LOG_NDELAY, DHCPD_LOG_FACILITY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
@@ -96,6 +96,8 @@ int main (argc, argv, envp)
|
|||||||
note (copyright);
|
note (copyright);
|
||||||
note (arr);
|
note (arr);
|
||||||
|
|
||||||
|
log_perror = 0;
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
if (!strcmp (argv [i], "-p")) {
|
if (!strcmp (argv [i], "-p")) {
|
||||||
if (++i == argc)
|
if (++i == argc)
|
||||||
@@ -129,24 +131,7 @@ int main (argc, argv, envp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the user didn't ask for debug mode, close the log and
|
|
||||||
reopen it without the LOG_STDERR flag. */
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
if (!log_perror) {
|
|
||||||
closelog ();
|
|
||||||
|
|
||||||
#ifdef SYSLOG_4_2
|
|
||||||
openlog ("dhcpd", LOG_NDELAY);
|
|
||||||
log_priority = DHCPD_LOG_FACILITY;
|
|
||||||
#else
|
|
||||||
openlog ("dhcpd", LOG_NDELAY, DHCPD_LOG_FACILITY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SYSLOG_4_2
|
|
||||||
setlogmask (LOG_UPTO (LOG_INFO));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (daemon) {
|
if (daemon) {
|
||||||
/* Become a daemon... */
|
/* Become a daemon... */
|
||||||
if ((pid = fork ()) < 0)
|
if ((pid = fork ()) < 0)
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static char objcopyright[] =
|
static char objcopyright[] =
|
||||||
"$Id: dhcpd.c,v 1.26 1996/08/27 09:44:54 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
|
"$Id: dhcpd.c,v 1.27 1996/08/28 01:30:19 mellon Exp $ Copyright 1995, 1996 The Internet Software Consortium.";
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"Copyright 1995, 1996 The Internet Software Consortium.";
|
"Copyright 1995, 1996 The Internet Software Consortium.";
|
||||||
static char arr [] = "All rights reserved.";
|
static char arr [] = "All rights reserved.";
|
||||||
@@ -63,6 +63,7 @@ struct interface_info fallback_interface;
|
|||||||
|
|
||||||
u_int16_t server_port;
|
u_int16_t server_port;
|
||||||
int log_priority;
|
int log_priority;
|
||||||
|
int log_perror = 1;
|
||||||
|
|
||||||
int main (argc, argv, envp)
|
int main (argc, argv, envp)
|
||||||
int argc;
|
int argc;
|
||||||
@@ -76,15 +77,14 @@ int main (argc, argv, envp)
|
|||||||
int pid;
|
int pid;
|
||||||
char pbuf [20];
|
char pbuf [20];
|
||||||
int daemon = 1;
|
int daemon = 1;
|
||||||
int log_perror = 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Initially, log errors to stderr as well as to syslogd. */
|
/* Initially, log errors to stderr as well as to syslogd. */
|
||||||
#ifdef SYSLOG_4_2
|
#ifdef SYSLOG_4_2
|
||||||
openlog ("dhcpd", LOG_NDELAY | LOG_PERROR);
|
openlog ("dhcpd", LOG_NDELAY);
|
||||||
log_priority = DHCPD_LOG_FACILITY;
|
log_priority = DHCPD_LOG_FACILITY;
|
||||||
#else
|
#else
|
||||||
openlog ("dhcpd", LOG_NDELAY | LOG_PERROR, DHCPD_LOG_FACILITY);
|
openlog ("dhcpd", LOG_NDELAY, DHCPD_LOG_FACILITY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
@@ -96,6 +96,8 @@ int main (argc, argv, envp)
|
|||||||
note (copyright);
|
note (copyright);
|
||||||
note (arr);
|
note (arr);
|
||||||
|
|
||||||
|
log_perror = 0;
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
if (!strcmp (argv [i], "-p")) {
|
if (!strcmp (argv [i], "-p")) {
|
||||||
if (++i == argc)
|
if (++i == argc)
|
||||||
@@ -129,24 +131,7 @@ int main (argc, argv, envp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If the user didn't ask for debug mode, close the log and
|
|
||||||
reopen it without the LOG_STDERR flag. */
|
|
||||||
#ifndef DEBUG
|
#ifndef DEBUG
|
||||||
if (!log_perror) {
|
|
||||||
closelog ();
|
|
||||||
|
|
||||||
#ifdef SYSLOG_4_2
|
|
||||||
openlog ("dhcpd", LOG_NDELAY);
|
|
||||||
log_priority = DHCPD_LOG_FACILITY;
|
|
||||||
#else
|
|
||||||
openlog ("dhcpd", LOG_NDELAY, DHCPD_LOG_FACILITY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef SYSLOG_4_2
|
|
||||||
setlogmask (LOG_UPTO (LOG_INFO));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (daemon) {
|
if (daemon) {
|
||||||
/* Become a daemon... */
|
/* Become a daemon... */
|
||||||
if ((pid = fork ()) < 0)
|
if ((pid = fork ()) < 0)
|
||||||
|
Reference in New Issue
Block a user