diff -r ea32aa303987 -r fff217764431 drivers/can_peak_win32/can_peak_win32.c --- a/drivers/can_peak_win32/can_peak_win32.c Wed Sep 30 12:01:25 2009 +0200 +++ b/drivers/can_peak_win32/can_peak_win32.c Mon Oct 05 11:35:40 2009 +0200 @@ -217,6 +217,7 @@ UNS8 canSend_driver (CAN_HANDLE fd0, Message * m) { UNS8 data; + DWORD localerrno; TPCANMsg peakMsg; peakMsg.ID = m->cob_id; /* 11/29 bit code */ if (m->rtr == 0) @@ -236,19 +237,19 @@ // if not the first handler if(second_board == (s_BOARD *)fd0) { - errno = CAN2_Write (&peakMsg); + errno = localerrno = CAN2_Write (&peakMsg); } else #endif if(first_board == (s_BOARD *)fd0) { - errno = CAN_Write (&peakMsg); + errno = localerrno = CAN_Write (&peakMsg); } else goto fail; - if (errno) - { - if (errno == CAN_ERR_BUSOFF) + if (localerrno) + { + if (localerrno == CAN_ERR_BUSOFF) { printf ("!!! Peak board write : re-init\n"); canInit((s_BOARD*)fd0); @@ -257,7 +258,7 @@ usleep (1000); } } - while (errno != CAN_ERR_OK); + while (localerrno != CAN_ERR_OK); #if defined DEBUG_MSG_CONSOLE_ON MSG("out : "); print_message(m);