struct server *srv; /* server associated with the error (or NULL) */
struct proxy *oe; /* other end = frontend or backend involved */
struct sockaddr_storage src; /* client's address */
- char buf[BUFSIZE]; /* copy of the beginning of the message */
+ char *buf; /* copy of the beginning of the message (may be NULL) */
};
struct email_alert {
}
/* OK, ptr >= 0, so we have to dump the current line */
- while (appctx->ctx.errors.ptr < es->len && appctx->ctx.errors.ptr < sizeof(es->buf)) {
+ while (es->buf && appctx->ctx.errors.ptr < es->len && appctx->ctx.errors.ptr < global.tune.bufsize) {
int newptr;
int newline;
newline = appctx->ctx.errors.bol;
- newptr = dump_text_line(&trash, es->buf, sizeof(es->buf), es->len, &newline, appctx->ctx.errors.ptr);
+ newptr = dump_text_line(&trash, es->buf, global.tune.bufsize, es->len, &newline, appctx->ctx.errors.ptr);
if (newptr == appctx->ctx.errors.ptr)
return 0;
struct channel *chn = msg->chn;
int len1, len2;
- es->len = MIN(chn->buf->i, sizeof(es->buf));
+ es->len = MIN(chn->buf->i, global.tune.bufsize);
len1 = chn->buf->data + chn->buf->size - chn->buf->p;
len1 = MIN(len1, es->len);
len2 = es->len - len1; /* remaining data if buffer wraps */
- memcpy(es->buf, chn->buf->p, len1);
- if (len2)
- memcpy(es->buf + len1, chn->buf->data, len2);
+ if (!es->buf)
+ es->buf = malloc(global.tune.bufsize);
+
+ if (es->buf) {
+ memcpy(es->buf, chn->buf->p, len1);
+ if (len2)
+ memcpy(es->buf + len1, chn->buf->data, len2);
+ }
if (msg->err_pos >= 0)
es->pos = msg->err_pos;