Re: [PATCH 20/32] tools:iio:iio_event_monitor: check if event is fully read

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Cameron schrieb am 31.05.2015 um 20:36:
> On 31/05/15 13:40, Hartmut Knaack wrote:
>> Check that the read event is of the expected size.
>>
>> Signed-off-by: Hartmut Knaack <knaack.h@xxxxxx>
> Is this a meaningful thing to do?  Something has gone horribly wrong if this occurs..
> Perhaps just dropping out entirely is a better bet?
> 

Well, my main intention was just to prevent passing garbage data to print_event().
But if you put it this way, then aborting seems more reasonable. Will change it.
Thanks,

Hartmut

>> ---
>>  tools/iio/iio_event_monitor.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/tools/iio/iio_event_monitor.c b/tools/iio/iio_event_monitor.c
>> index 1316527..ecee8ac 100644
>> --- a/tools/iio/iio_event_monitor.c
>> +++ b/tools/iio/iio_event_monitor.c
>> @@ -304,6 +304,11 @@ int main(int argc, char **argv)
>>  			}
>>  		}
>>  
>> +		if (ret != sizeof(event)) {
>> +			printf("Reading event failed, trying again\n");
>> +			continue;
>> +		}
>> +
>>  		print_event(&event);
>>  	}
>>  
>>
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux