Skip to content
Browse files

Bugfix Update

- mistake on assuming close return value... fixed!
- was not found earlier because return value was never checked? :o
  • Loading branch information...
1 parent dd7b9de commit 664b0b81f0e2833df37202b8021f69955cab8a14 @azman committed Oct 29, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 src/my1comlib.c
View
5 src/my1comlib.c
@@ -128,11 +128,12 @@ int close_serial(ASerialPort_t* aPort)
if(aPort->mHandle==INVALID_HANDLE_VALUE)
return cCheck;
#ifdef DO_MINGW
- cCheck = CloseHandle(aPort->mHandle);
+ cCheck = CloseHandle(aPort->mHandle); /* returns !0:success, 0:error! */
#else
/* set saved original attributes */
tcsetattr(aPort->mHandle, TCSANOW, &aPort->mTIOsave);
- cCheck = close(aPort->mHandle);
+ cCheck = close(aPort->mHandle); /* returns 0:success, -1:error! */
+ if(cCheck<0) cCheck = 0; else cCheck = 1;
#endif
if(cCheck)
aPort->mHandle = INVALID_HANDLE_VALUE;

0 comments on commit 664b0b8

Please sign in to comment.
Something went wrong with that request. Please try again.