summaryrefslogtreecommitdiffstats
path: root/configd
diff options
context:
space:
mode:
Diffstat (limited to 'configd')
-rw-r--r--configd/src/apps/sentinel/line-splitter.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/configd/src/apps/sentinel/line-splitter.cpp b/configd/src/apps/sentinel/line-splitter.cpp
index e52f4e3f33e..ec1fe41e766 100644
--- a/configd/src/apps/sentinel/line-splitter.cpp
+++ b/configd/src/apps/sentinel/line-splitter.cpp
@@ -88,7 +88,11 @@ LineSplitter::getLine()
char *start = &_buffer[_readPos];
char *end = static_cast<char *>(memchr(start, '\n', bufLen));
if (_eof && !end) {
- end = &_buffer[_writePos-1]; // pretend last byte sent was \n
+ if (_writePos < _size) {
+ end = &_buffer[_writePos]; // pretend last byte sent was followed by \n
+ } else {
+ end = &_buffer[_writePos-1]; // pretend last byte sent was \n
+ }
}
if (end) {
*end = '\0';