Commit 184c489cbd7e70b5fb36bf0ca855a5e5badb642a
1 parent
8813c7e0
Fix C compiler compliance error
Showing
1 changed file
with
3 additions
and
1 deletions
src/modbus.c
| @@ -122,12 +122,14 @@ static void _sleep_response_timeout(modbus_t *ctx) | @@ -122,12 +122,14 @@ static void _sleep_response_timeout(modbus_t *ctx) | ||
| 122 | 122 | ||
| 123 | int modbus_flush(modbus_t *ctx) | 123 | int modbus_flush(modbus_t *ctx) |
| 124 | { | 124 | { |
| 125 | + int rc; | ||
| 126 | + | ||
| 125 | if (ctx == NULL) { | 127 | if (ctx == NULL) { |
| 126 | errno = EINVAL; | 128 | errno = EINVAL; |
| 127 | return -1; | 129 | return -1; |
| 128 | } | 130 | } |
| 129 | 131 | ||
| 130 | - int rc = ctx->backend->flush(ctx); | 132 | + rc = ctx->backend->flush(ctx); |
| 131 | if (rc != -1 && ctx->debug) { | 133 | if (rc != -1 && ctx->debug) { |
| 132 | /* Not all backends are able to return the number of bytes flushed */ | 134 | /* Not all backends are able to return the number of bytes flushed */ |
| 133 | printf("Bytes flushed (%d)\n", rc); | 135 | printf("Bytes flushed (%d)\n", rc); |