Bugzilla – Bug 1567
Build fails with /* #undef HAVE_SYSLOG_H */
Last modified: 2017-10-11 08:50:25 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’?
#define FACILITY LOG_DAEMON
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).
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