Преглед на файлове

Fix: CreateFile() does not set errno. Use GetLastError().

oldfaber преди 13 години
родител
ревизия
35b707c953
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  1. 2 2
      src/modbus-rtu.c

+ 2 - 2
src/modbus-rtu.c

@@ -437,8 +437,8 @@ static int _modbus_rtu_connect(modbus_t *ctx)
 
     /* Error checking */
     if (ctx_rtu->w_ser.fd == INVALID_HANDLE_VALUE) {
-        fprintf(stderr, "ERROR Can't open the device %s (%s)\n",
-                ctx_rtu->device, strerror(errno));
+        fprintf(stderr, "ERROR Can't open the device %s (LastError %d)\n",
+                ctx_rtu->device, (int)GetLastError());
         return -1;
     }