From: Bartosz Golaszewski Date: Mon, 9 Jan 2017 14:12:03 +0000 (+0100) Subject: core: fix gpiod_line_event_request() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=114a2c87aa8666fffbbaa6519cc5b1b4f762edfb;p=qemu-gpiodev%2Flibgpiod.git core: fix gpiod_line_event_request() Correctly set the last error if the line is busy. Signed-off-by: Bartosz Golaszewski --- 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;