From 01f2f1126eae05c9c1bd4b0560fd154e475b3bda Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sat, 12 May 2012 06:33:32 +0200 Subject: Report with different error codes if library will block until buffer is free or if the supplied block is too big to fit into the buffer --- fastwriter.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fastwriter.c b/fastwriter.c index 84ef022..e812681 100644 --- a/fastwriter.c +++ b/fastwriter.c @@ -241,9 +241,13 @@ static void *fastwriter_writer_thread(void *user) { int fastwriter_push(fastwriter_t *ctx, size_t size, const void *data) { size_t part1, end; size_t free = fastwriter_compute_free_space(ctx); - + if (free < size) { ctx->max_usage = ctx->size; + + if (size > ctx->size) { + return EOVERFLOW; + } if ((ctx->flags&FASTWRITER_FLAGS_BLOCK)==0) return EWOULDBLOCK; -- cgit v1.2.1