Avoid warnings about not checking read() result in wxJoystick code.

Explicitly ignore errors if we can't read from the associated FD.

This is mostly done to avoid -Wunused-result warning about not checking read()
return value under Ubuntu.

This is the backport of a74d2faf3a from master.
This commit is contained in:
Vadim Zeitlin
2015-04-17 13:34:36 +02:00
parent ce62dc893a
commit feef92f3e2

View File

@@ -129,7 +129,12 @@ void* wxJoystickThread::Entry()
if (wxFD_ISSET(m_device, &read_fds))
{
memset(&j_evt, 0, sizeof(j_evt));
read(m_device, &j_evt, sizeof(j_evt));
if ( read(m_device, &j_evt, sizeof(j_evt)) == -1 )
{
// We can hardly do anything other than ignoring the error and
// hope that we read the next event successfully.
continue;
}
//printf("time: %d\t value: %d\t type: %d\t number: %d\n",
// j_evt.time, j_evt.value, j_evt.type, j_evt.number);