TS-2784 Fix build for FreeBSD10

(cherry picked from commit 3b6748ed2117cd824049498508fa3b1609f5638a)
[TS-2822] Crash in LogBufferIterator::next

(cherry picked from commit 13453d9ab8c975fd12da632a49868eeaf2eb1fd3)