Flush only the requested buffers

Fix the sp_flush() so that it flushes only the requested buffers
also in unix.
This commit is contained in:
Janne Huttunen 2014-10-11 12:13:41 +03:00 committed by Uwe Hermann
parent d66bbceaa7
commit ad7498553c
1 changed files with 3 additions and 3 deletions

View File

@ -618,11 +618,11 @@ SP_API enum sp_return sp_flush(struct sp_port *port, enum sp_buffer buffers)
RETURN_FAIL("PurgeComm() failed"); RETURN_FAIL("PurgeComm() failed");
#else #else
int flags = 0; int flags = 0;
if (buffers & SP_BUF_BOTH) if (buffers == SP_BUF_BOTH)
flags = TCIOFLUSH; flags = TCIOFLUSH;
else if (buffers & SP_BUF_INPUT) else if (buffers == SP_BUF_INPUT)
flags = TCIFLUSH; flags = TCIFLUSH;
else if (buffers & SP_BUF_OUTPUT) else if (buffers == SP_BUF_OUTPUT)
flags = TCOFLUSH; flags = TCOFLUSH;
/* Returns 0 upon success, -1 upon failure. */ /* Returns 0 upon success, -1 upon failure. */