@@ -122,7 +122,7 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
122
122
struct fpm_event_s * event ;
123
123
int fifo_in = 1 , fifo_out = 1 ;
124
124
int in_buf = 0 ;
125
- int read_fail = 0 , finish_log_stream = 0 ;
125
+ int read_fail = 0 , finish_log_stream = 0 , create_log_stream ;
126
126
int res ;
127
127
struct zlog_stream * log_stream ;
128
128
@@ -138,7 +138,8 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
138
138
event = & child -> ev_stderr ;
139
139
}
140
140
141
- if (!child -> log_stream ) {
141
+ create_log_stream = !child -> log_stream ;
142
+ if (create_log_stream ) {
142
143
log_stream = child -> log_stream = malloc (sizeof (struct zlog_stream ));
143
144
zlog_stream_init_ex (log_stream , ZLOG_WARNING , STDERR_FILENO );
144
145
zlog_stream_set_decorating (log_stream , child -> wp -> config -> decorate_workers_output );
@@ -196,8 +197,10 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
196
197
}
197
198
198
199
if (read_fail ) {
199
- zlog_stream_set_msg_suffix (log_stream , NULL , ", pipe is closed" );
200
- zlog_stream_finish (log_stream );
200
+ if (create_log_stream ) {
201
+ zlog_stream_set_msg_suffix (log_stream , NULL , ", pipe is closed" );
202
+ zlog_stream_finish (log_stream );
203
+ }
201
204
if (read_fail < 0 ) {
202
205
zlog (ZLOG_SYSERROR , "unable to read what child say" );
203
206
}
0 commit comments