diff --git a/mq.c b/mq.c index d7524c3..58519aa 100644 --- a/mq.c +++ b/mq.c @@ -79,7 +79,7 @@ haggis_msg* haggis_mq_pop(haggis_mq *queue) { queue->count--; msg = queue->head; if (msg->tag == EndOfArchive) - return NULL; + return msg; if (queue->tail == queue->head) { queue->tail = queue->head = NULL; } else { diff --git a/test/Makefile b/test/Makefile index 4434e23..6ec1663 100644 --- a/test/Makefile +++ b/test/Makefile @@ -70,7 +70,7 @@ tests += create_symlink_node tests += create_fifo_node tests += create_dev_node tests += create_file_node -tests += haggis_mq_push_pop +tests += mq_push_pop total != echo $(tests) | wc -w | awk '{ print $$1 }' diff --git a/test/haggis_mq_push_pop.c b/test/mq_push_pop.c similarity index 94% rename from test/haggis_mq_push_pop.c rename to test/mq_push_pop.c index 9560f06..2aaaa80 100644 --- a/test/haggis_mq_push_pop.c +++ b/test/mq_push_pop.c @@ -44,7 +44,8 @@ int main() { assert(memcmp(m3->body.f_name, "/bin/cat", 8) == 0); free(m3); - /*m4 = haggis_mq_pop(&mq); + m4 = haggis_mq_pop(&mq); assert(m4->tag == EndOfArchive); - assert(mq.head != NULL);*/ + assert(mq.head != NULL); + free(m4); } \ No newline at end of file