From 184c489cbd7e70b5fb36bf0ca855a5e5badb642a Mon Sep 17 00:00:00 2001 From: Stéphane Raimbault Date: Thu, 7 Nov 2013 13:16:00 +0100 Subject: [PATCH] Fix C compiler compliance error --- src/modbus.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/modbus.c b/src/modbus.c index ebb0f76..356d006 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -122,12 +122,14 @@ static void _sleep_response_timeout(modbus_t *ctx) int modbus_flush(modbus_t *ctx) { + int rc; + if (ctx == NULL) { errno = EINVAL; return -1; } - int rc = ctx->backend->flush(ctx); + rc = ctx->backend->flush(ctx); if (rc != -1 && ctx->debug) { /* Not all backends are able to return the number of bytes flushed */ printf("Bytes flushed (%d)\n", rc); -- libgit2 0.21.4