/*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2021 The Squid Software Foundation and contributors
*
* Squid software is distributed under GPLv2+ license and includes
* contributions from numerous individuals and organizations.
ll->flush_pending = 0;
int ret = FD_WRITE_METHOD(ll->wfd, b->buf + b->written_len, b->len - b->written_len);
+ int xerrno = errno;
debugs(50, 3, lf->path << ": write returned " << ret);
if (ret < 0) {
- if (ignoreErrno(errno)) {
+ if (ignoreErrno(xerrno)) {
/* something temporary */
Comm::SetSelect(ll->wfd, COMM_SELECT_WRITE, logfileHandleWrite, lf, 0);
ll->flush_pending = 1;
return;
}
- debugs(50, DBG_IMPORTANT,"logfileHandleWrite: " << lf->path << ": error writing (" << xstrerror() << ")");
+ debugs(50, DBG_IMPORTANT,"logfileHandleWrite: " << lf->path << ": error writing (" << xstrerr(xerrno) << ")");
/* XXX should handle this better */
fatal("I don't handle this error well!");
}
}
static void
-logfile_mod_daemon_rotate(Logfile * lf)
+logfile_mod_daemon_rotate(Logfile * lf, const int16_t)
{
char tb[3];
debugs(50, DBG_IMPORTANT, "logfileRotate: " << lf->path);
}
return;
}
- /* Append this data to the end buffer; create a new one if needed */
+
/* Are we eol? If so, prefix with our logfile command byte */
+ if (ll->eol == 1) {
+ logfile_mod_daemon_append(lf, "L", 1);
+ ll->eol = 0;
+ }
+
+ /* Append this data to the end buffer; create a new one if needed */
logfile_mod_daemon_append(lf, buf, len);
}
logfile_mod_daemon_linestart(Logfile * lf)
{
l_daemon_t *ll = static_cast<l_daemon_t *>(lf->data);
- char tb[2];
assert(ll->eol == 1);
- ll->eol = 0;
- tb[0] = 'L';
- tb[1] = '\0';
- logfile_mod_daemon_append(lf, tb, 1);
+ // logfile_mod_daemon_writeline() sends the starting command
}
static void
{
l_daemon_t *ll = static_cast<l_daemon_t *>(lf->data);
logfile_buffer_t *b;
- assert(ll->eol == 0);
+ if (ll->eol == 1) // logfile_mod_daemon_writeline() wrote nothing
+ return;
ll->eol = 1;
/* Kick a write off if the head buffer is -full- */
if (ll->bufs.head != NULL) {