Add packet-dump debugging facility.

This commit is contained in:
Simon Kelley
2018-05-08 18:32:14 +01:00
parent 07ed585c38
commit 6b17335209
10 changed files with 329 additions and 11 deletions

View File

@@ -366,7 +366,16 @@ int main (int argc, char **argv)
else
daemon->inotifyfd = -1;
#endif
if (daemon->dump_file)
#ifdef HAVE_DUMPFILE
dump_init();
else
daemon->dumpfd = -1;
#else
die(_("Packet dumps not available: set HAVE_DUMP in src/config.h"), NULL, EC_BADCONF);
#endif
if (option_bool(OPT_DBUS))
#ifdef HAVE_DBUS
{
@@ -1424,6 +1433,11 @@ static void async_event(int pipe, time_t now)
if (daemon->runfile)
unlink(daemon->runfile);
#ifdef HAVE_DUMPFILE
if (daemon->dumpfd != -1)
close(daemon->dumpfd);
#endif
my_syslog(LOG_INFO, _("exiting on receipt of SIGTERM"));
flush_log();