summaryrefslogtreecommitdiffstats
path: root/src/core/buffer.c
diff options
context:
space:
mode:
authorMichael Brown2007-01-11 05:46:41 +0100
committerMichael Brown2007-01-11 05:46:41 +0100
commitc0ef730ec427e9ee20da3b1fb2500b6593783385 (patch)
tree21b8445550dc040ce832d6e7a3974c31be0bc783 /src/core/buffer.c
parentAdded strerror(0)=="No error", so that TCP protocols can use (diff)
downloadipxe-c0ef730ec427e9ee20da3b1fb2500b6593783385.tar.gz
ipxe-c0ef730ec427e9ee20da3b1fb2500b6593783385.tar.xz
ipxe-c0ef730ec427e9ee20da3b1fb2500b6593783385.zip
Fix bug in buffer.c, add buffer mini-unit test.
Diffstat (limited to 'src/core/buffer.c')
-rw-r--r--src/core/buffer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/buffer.c b/src/core/buffer.c
index be4c6055..91df7b66 100644
--- a/src/core/buffer.c
+++ b/src/core/buffer.c
@@ -80,21 +80,21 @@ struct buffer_free_block {
* @ret block Next free block descriptor
* @ret rc Return status code
*
- * Set @c block->next=buffer->free before first call to
+ * Set @c block->next=buffer->fill before first call to
* get_next_free_block().
*/
static int get_next_free_block ( struct buffer *buffer,
struct buffer_free_block *block ) {
/* Check for end of buffer */
- if ( block->end >= buffer->len )
+ if ( block->next >= buffer->len )
return -ENOENT;
/* Move to next block */
block->start = block->next;
if ( block->start >= buffer->free ) {
/* Final block; no in-band descriptor */
- block->end = buffer->len;
+ block->next = block->end = buffer->len;
} else {
/* Retrieve block descriptor */
copy_from_phys ( block, ( buffer->addr + block->start ),