summaryrefslogtreecommitdiffstats
path: root/fastwriter.c
diff options
context:
space:
mode:
Diffstat (limited to 'fastwriter.c')
-rw-r--r--fastwriter.c6
1 files changed, 5 insertions, 1 deletions
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;