Don't abuse std::find to find end of special message.
authorDavin McCall <davmac@davmac.org>
Sun, 2 Jun 2019 09:28:57 +0000 (19:28 +1000)
committerDavin McCall <davmac@davmac.org>
Sat, 29 Jun 2019 04:06:09 +0000 (14:06 +1000)
Cherry-picked from development branch.

src/dinit-log.cc

index dbdf868760c34a99e41348292263b81a279a189f..09e4e78216189b70ba1046dc4f47c21d26a57a89 100644 (file)
@@ -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) {