From a21c0e60d24a7a10279a91a29b333f0421fe9107 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 5 Sep 2018 15:07:15 +0200 Subject: [PATCH] MINOR: log: make the backend fall back to the frontend when there's no stream This is already what happens before the backend is assigned, except that now we don't need to dereference a NULL stream to figure this. --- src/log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/log.c b/src/log.c index 4e7818da0..2613940e7 100644 --- a/src/log.c +++ b/src/log.c @@ -1571,7 +1571,7 @@ void deinit_log_buffers() int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t maxsize, struct list *list_format) { struct proxy *fe = sess->fe; - struct proxy *be = s->be; + struct proxy *be = s ? s->be : fe; struct http_txn *txn = s->txn; struct buffer chunk; char *uri; @@ -1995,7 +1995,7 @@ int sess_build_logline(struct session *sess, struct stream *s, char *dst, size_t break; case LOG_FMT_TD: // %Td - if (s->be->mode == PR_MODE_HTTP) + if (be->mode == PR_MODE_HTTP) ret = ltoa_o((s->logs.t_data >= 0) ? s->logs.t_close - s->logs.t_data : -1, tmplog, dst + maxsize - tmplog); else