From: Willy Tarreau Date: Wed, 5 Sep 2018 13:07:15 +0000 (+0200) Subject: MINOR: log: make the backend fall back to the frontend when there's no stream X-Git-Tag: v1.9-dev2~93 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a21c0e60d24a7a10279a91a29b333f0421fe9107;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/src/log.c b/src/log.c index 4e7818da06..2613940e7e 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