core: improve error handling
authorBartosz Golaszewski <bartekgola@gmail.com>
Fri, 17 Nov 2017 14:03:14 +0000 (15:03 +0100)
committerBartosz Golaszewski <bartekgola@gmail.com>
Fri, 17 Nov 2017 14:15:32 +0000 (15:15 +0100)
commitf4e3b51f92c2e13c2c5a29dd9b063553d8f7a373
treea39634330d3c95e5fbf0e6c9ef6b7c3a376d832b
parent3a3d69137b4c2fdcbcfe89ed55ea0c15dd0d7573
core: improve error handling

Rework the way we verify that line bulk objects are consistent: split
the verify_line_bulk() function into sub-routines, make the names more
self-explanatory and add other minor fixes & tweaks.

Improve the consistency of errno codes: set errno to EPERM if the line
for which gpiod_line_event_get_fd() is called is not configured for
event monitoring.

We were already testing that line requests fail if we pass them a line
bulk containing lines from different chips, but add an analogous test
for gpiod_line_get_value_bulk().

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
src/lib/core.c
tests/tests-event.c
tests/tests-line.c