littlekernel / lk

LK embedded kernel
MIT License
3.14k stars 615 forks source link

[lib/cbuf] [app/tests] fix off by one in lib/cbuf. add a test. #173

Closed girtsf closed 7 years ago

girtsf commented 7 years ago

Previously, if tail was == 0, and we wrote exactly enough bytes to the end of the buffer, then head would end up at 0 as well. This would make the buffer instaneously empty, as head == tail.