From: Davin McCall Date: Sun, 2 Jun 2019 09:28:57 +0000 (+1000) Subject: Don't abuse std::find to find end of special message. X-Git-Tag: v0.5.2~7 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=af603439b2a1fa98af495f9d3c2be1d74cd24d87;p=oweals%2Fdinit.git Don't abuse std::find to find end of special message. Cherry-picked from development branch. --- diff --git a/src/dinit-log.cc b/src/dinit-log.cc index dbdf868..09e4e78 100644 --- a/src/dinit-log.cc +++ b/src/dinit-log.cc @@ -163,7 +163,8 @@ rearm buffered_log_stream::fd_event(eventloop_t &loop, int fd, int flags) noexce if ((! partway) && special) { const char * start = special_buf + msg_index; - const char * end = std::find(special_buf + msg_index, (const char *)nullptr, '\n'); + const char * end = start; + while (*end != '\n') end++; int r = write(fd, start, end - start + 1); if (r >= 0) { if (start + r > end) {