Commit fe8d9de65e7aa5c2609ef4e4582f5689f0ea2ec8

Authored by Stéphane Raimbault
1 parent 99b4e417

Enhanced error message for RTU open (serial)

- use strerror instead of error number
Showing 1 changed file with 2 additions and 2 deletions
modbus/modbus.c
@@ -1388,8 +1388,8 @@ static int modbus_connect_rtu(modbus_param_t *mb_param) @@ -1388,8 +1388,8 @@ static int modbus_connect_rtu(modbus_param_t *mb_param)
1388 mb_param->fd = open(mb_param->device, O_RDWR | O_NOCTTY | O_NDELAY); 1388 mb_param->fd = open(mb_param->device, O_RDWR | O_NOCTTY | O_NDELAY);
1389 if (mb_param->fd < 0) { 1389 if (mb_param->fd < 0) {
1390 perror("open"); 1390 perror("open");
1391 - printf("ERROR Can't open the device %s (errno %d)\n",  
1392 - mb_param->device, errno); 1391 + printf("ERROR Can't open the device %s (%s)\n",
  1392 + mb_param->device, strerror(errno));
1393 return -1; 1393 return -1;
1394 } 1394 }
1395 1395