If a GPIO chip with given label cannot be found but no other error
occurred, set errno to ENOENT before returning a NULL pointer.
Update the relevant test case.
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
#include <string.h>
#include <errno.h>
#include <ctype.h>
+#include <errno.h>
static bool isuint(const char *str)
{
}
}
+ errno = ENOENT;
+
out:
gpiod_chip_iter_free(iter);
+
return NULL;
}
chip = gpiod_chip_open_by_label("nonexistent_gpio_chip");
TEST_ASSERT_NULL(chip);
+ TEST_ASSERT_ERRNO_IS(ENOENT);
}
TEST_DEFINE(chip_open_by_label_bad,
"gpiod_chip_open_by_label() - bad",