Reload log file on SIGHUP
There's a report about a nightly "crash" when users download, compile from source, and replace their distro's mindlnad binary. This is because the Debian package includes a patch that uses SIGUSR2 to reopen the log file and sends SIGUSR2 from logrotate instead of just using the "copytruncate" logrotate option. Then logrotate sends SIGUSR2 at 6:25AM, which causes us to abort due to the unhandled signal. I don't want to sacrifice SIGUSR2 just for log rotation, especially when we already do some reload operations on SIGHUP. So to avoid this Debian/Ubuntu issue, we'll explicitly ignore SIGUSR2, and add log file reopening to the SIGHUP handler. Then hopefully a future Debian package version will remove the SIGUSR2 patch and use SIGHUP instead (or copytruncate). Fixes: SF Bug #313 (log rotation kills minidlna service)
This commit is contained in:
3
log.h
3
log.h
@ -44,8 +44,9 @@ enum _log_facility
|
||||
};
|
||||
|
||||
extern int log_level[L_MAX];
|
||||
extern int log_init(const char *fname, const char *debug);
|
||||
extern int log_init(const char *debug);
|
||||
extern void log_close(void);
|
||||
extern void log_reopen(void);
|
||||
extern void log_err(int level, enum _log_facility facility, char *fname, int lineno, char *fmt, ...)
|
||||
__attribute__((__format__ (__printf__, 5, 6)));
|
||||
|
||||
|
Reference in New Issue
Block a user