Conversation
php-fpm does not close stderr when using syslog
|
This does merge cleanly in supported branch, but I'm not sure about it still ... actually I don't get the logic of it at all, and think the comment could do a better job of explaining the magic being used. Can someone familiar with both fpm and stdio (in particular dup'ing) check this please. I can't merge it without input from elsewhere ... In the mean time, rebasing against supported branch would be a good idea @m6w6 |
|
When a program daemonizes itself (like php-fpm does), it's supposed to close the three First, note from #define ZLOG_SYSLOG -2Then in int fpm_stdio_init_main() /* {{{ */
{
int fd = open("/dev/null", O_RDWR);
...
if (0 > dup2(fd, STDIN_FILENO) || 0 > dup2(fd, STDOUT_FILENO)) {The only confusion is with what to do about int fpm_stdio_init_final() /* {{{ */
{
if (fpm_use_error_log()) {
/* prevent duping if logging to syslog */
if (fpm_globals.error_log_fd > 0 && fpm_globals.error_log_fd != STDERR_FILENO) {
/* there might be messages to stderr from other parts of the code, we need to log them all */
if (0 > dup2(fpm_globals.error_log_fd, STDERR_FILENO)) {The first "if" statement ensures that we're not running interactively, because in that case we should just print stuff to the screen. The second "if" statement ensures that we're not logging to syslog, because That omits a case, however. What do we do with |
|
Huh, totally missed that ping, sorry & thanks a lot! |
php-fpm does not close stderr when using syslog
Someone with FPM knowledge should have another look.