Bug 1567 - Build fails with /* #undef HAVE_SYSLOG_H */
Build fails with /* #undef HAVE_SYSLOG_H */
Product: NSD
Classification: Unclassified
Component: NSD Code
x86_64 Linux
: P5 trivial
Assigned To: NSD team
Depends on:
  Show dependency treegraph
Reported: 2017-10-11 06:01 CEST by Michael Forney
Modified: 2017-10-11 08:50 CEST (History)
2 users (show)

See Also:

patch fixing the issue (717 bytes, patch)
2017-10-11 06:01 CEST, Michael Forney
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Forney 2017-10-11 06:01:22 CEST
Created attachment 461 [details]
patch fixing the issue

I want to build nsd without syslog functionality since I plan to run it under a process supervisor which already handles logging. I saw that the functionality was disabled when HAVE_SYSLOG_H is undefined, but it appears that the build is broken under this configuration.

netio.c: In function ‘netio_current_time’:
netio.c:97:12: error: ‘LOG_CRIT’ undeclared (first use in this function); did you mean ‘LOG_ERR’?

nsd.c: In function ‘main’:
nsd.c:907:11: error: ‘LOG_PID’ undeclared (first use in this function); did you mean ‘P_PID’?

config.h:27:18: error: ‘LOG_DAEMON’ undeclared (first use in this function); did you mean ‘LOG_ERR’?
nsd.c:907:20: note: in expansion of macro ‘FACILITY’
  log_open(LOG_PID, FACILITY, nsd.log_filename);

LOG_CRIT is needed for the log statement in netio.c:/^netio_current_time, and LOG_PID/LOG_DAEMON are needed for the call to log_open in nsd.c (even though the values are unused without HAVE_SYSLOG_H).

The attached patch fixes the issue, but since FACILITY is controlled through --with-facility, I'm not sure if just defining LOG_DAEMON is the right thing to do (though it would be silly for someone to pass --with-facility without HAVE_SYSLOG_H).
Comment 1 Wouter Wijngaards 2017-10-11 08:50:25 CEST
Hi Michael,

Thank you for the patch.  I have included it.  I removed the LOG_CRIT and changed it to LOG_ERR in the single use in netio.c.

I think --with-facility can stay the way it is, because I think nobody uses these options together, like you say.

Best regards, Wouter