diff --git a/modules/libcom/src/log/logClient.c b/modules/libcom/src/log/logClient.c index 28b933e02..4e647bd83 100644 --- a/modules/libcom/src/log/logClient.c +++ b/modules/libcom/src/log/logClient.c @@ -294,10 +294,10 @@ void epicsShareAPI logClientFlush ( logClientId id ) else if ( nSent > 0 && pClient->nextMsgIndex > 0 ) { pClient->backlog = epicsSocketCountUnsentBytes ( pClient->sock ); nSent -= pClient->backlog; - if ( nSent > 0 ) { + pClient->nextMsgIndex -= nSent; + if ( nSent > 0 && pClient->nextMsgIndex > 0 ) { memmove ( pClient->msgBuf, & pClient->msgBuf[nSent], pClient->nextMsgIndex ); - pClient->nextMsgIndex -= nSent; } } epicsMutexUnlock ( pClient->mutex );