From 114a2c87aa8666fffbbaa6519cc5b1b4f762edfb Mon Sep 17 00:00:00 2001 From: Bartosz Golaszewski Date: Mon, 9 Jan 2017 15:12:03 +0100 Subject: [PATCH] core: fix gpiod_line_event_request() Correctly set the last error if the line is busy. Signed-off-by: Bartosz Golaszewski --- core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core.c b/core.c index eff1e68..006e18b 100644 --- a/core.c +++ b/core.c @@ -576,8 +576,10 @@ int gpiod_line_event_request(struct gpiod_line *line, struct gpiod_chip *chip; int status, fd; - if (gpiod_line_event_configured(line)) - return -EBUSY; + if (!gpiod_line_is_free(line)) { + set_last_error(GPIOD_ELINEBUSY); + return -1; + } req = &line->event; -- 2.30.2