mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-08-22 01:49:35 +00:00
Allow trace output files (-tf option) to be overwritten, rather than
crashing dhcpd if the file already exists [rt16459]
This commit is contained in:
parent
61252edfa9
commit
a58da042f5
3
RELNOTES
3
RELNOTES
@ -27,6 +27,9 @@ the README file.
|
||||
|
||||
Changes since 3.1.0b1
|
||||
|
||||
- Allow trace output files (-tf option) to be overwritten, rather than
|
||||
crashing dhcpd if the file already exists
|
||||
|
||||
- A bug was fixed that caused dhcpd to segfault if a pool was declared
|
||||
outside the scope of a subnet in dhcpd.conf.
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#ifndef lint
|
||||
static char ocopyright[] =
|
||||
"$Id: trace.c,v 1.12 2006/02/24 23:16:30 dhankins Exp $ Copyright 2004-2006 Internet Systems Consortium.";
|
||||
"$Id: trace.c,v 1.13 2007/04/27 22:38:03 each Exp $ Copyright 2004-2006 Internet Systems Consortium.";
|
||||
#endif
|
||||
|
||||
#include <omapip/omapip_p.h>
|
||||
@ -57,6 +57,8 @@ trace_type_t trace_time_marker;
|
||||
extern omapi_array_t *trace_listeners;
|
||||
extern omapi_array_t *omapi_connections;
|
||||
|
||||
extern int errno;
|
||||
|
||||
void trace_free_all ()
|
||||
{
|
||||
trace_type_t *tp;
|
||||
@ -142,6 +144,11 @@ isc_result_t trace_begin (const char *filename,
|
||||
}
|
||||
|
||||
traceoutfile = open (filename, O_CREAT | O_WRONLY | O_EXCL, 0600);
|
||||
if (traceoutfile < 0 && errno == EEXIST) {
|
||||
log_error ("WARNING: Overwriting trace file \"%s\"", filename);
|
||||
traceoutfile = open (filename, O_WRONLY | O_EXCL, 0600);
|
||||
}
|
||||
|
||||
if (traceoutfile < 0) {
|
||||
log_error ("%s(%d): trace_begin: %s: %m",
|
||||
file, line, filename);
|
||||
|
Loading…
x
Reference in New Issue
Block a user