Explorar o código

Enhanced error message for RTU open (serial)

- use strerror instead of error number
Stéphane Raimbault %!s(int64=16) %!d(string=hai) anos
pai
achega
fe8d9de65e
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      modbus/modbus.c

+ 2 - 2
modbus/modbus.c

@@ -1388,8 +1388,8 @@ static int modbus_connect_rtu(modbus_param_t *mb_param)
         mb_param->fd = open(mb_param->device, O_RDWR | O_NOCTTY | O_NDELAY);
         if (mb_param->fd < 0) {
                 perror("open");
-                printf("ERROR Can't open the device %s (errno %d)\n",
-                       mb_param->device, errno);
+                printf("ERROR Can't open the device %s (%s)\n",
+                       mb_param->device, strerror(errno));
                 return -1;
         }