Skip to content

Commit

Permalink
modbus_set_slave error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
v-zhuravlev committed Sep 24, 2018
1 parent 7dd939a commit 5f55508
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/modbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,12 @@ int zbx_modbus_read_registers(AGENT_REQUEST *request, AGENT_RESULT *result)
modbus_free(ctx);
return SYSINFO_RET_FAIL;
}
modbus_set_slave(ctx, slave_id);
if (modbus_set_slave(ctx, slave_id) == -1)
{
SET_MSG_RESULT(result, strdup(modbus_strerror(errno)));
modbus_free(ctx);
return SYSINFO_RET_FAIL;
}

//<reg> set register to start from
errno = 0;
Expand Down

0 comments on commit 5f55508

Please sign in to comment.