From b24da5890e5b3282f872f66ddd721ababc57c657 Mon Sep 17 00:00:00 2001 From: Denis Date: Wed, 13 Dec 2023 15:26:43 +0100 Subject: [PATCH] Improved iio fail code --- dev_iio.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dev_iio.c b/dev_iio.c index 0e3b828..0b9018e 100644 --- a/dev_iio.c +++ b/dev_iio.c @@ -143,7 +143,9 @@ static int dev_iio_create(char* dev_path, const char* path, dev_iio_t **const ou (*out_iio)->fd = open((*out_iio)->dev_path, O_RDONLY); if ((*out_iio)->fd < 0) { - fprintf(stderr, "Error opening %s: %d", (*out_iio)->dev_path, errno); + fprintf(stderr, "Error opening %s: %d\n", (*out_iio)->dev_path, errno); + res = errno; + res = res < 0 ? res : -1 * res; goto dev_iio_create_err; }