summaryrefslogtreecommitdiffstats
path: root/fastwriter.c
diff options
context:
space:
mode:
Diffstat (limited to 'fastwriter.c')
-rw-r--r--fastwriter.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fastwriter.c b/fastwriter.c
index 08722fa..dd48493 100644
--- a/fastwriter.c
+++ b/fastwriter.c
@@ -64,8 +64,8 @@ int fastwriter_open(fastwriter_t *ctx, const char *name, fastwriter_flags_t flag
break;
case FASTWRITER_BUFFER_MAX:
ctx->size = fastwriter_get_free_memory();
-
- if ((ctx->size - FASTWRITER_RESERVE_MEMORY) < FASTWRITER_DEFAULT_BUFFER_SIZE)
+
+ if ((ctx->size == (size_t)-1)||((ctx->size - FASTWRITER_RESERVE_MEMORY) < FASTWRITER_DEFAULT_BUFFER_SIZE))
ctx->size = FASTWRITER_DEFAULT_BUFFER_SIZE;
else
ctx->size -= FASTWRITER_RESERVE_MEMORY;