projects
/
contrib
/
mraa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
15e400e
)
iio.c: Closedir correctly and return error if we fail to read from the device dir
author
Brendan Le Foll
<brendan.le.foll@intel.com>
Mon, 21 Dec 2015 15:38:20 +0000
(15:38 +0000)
committer
Brendan Le Foll
<brendan.le.foll@intel.com>
Mon, 21 Dec 2015 15:38:20 +0000
(15:38 +0000)
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
src/iio/iio.c
patch
|
blob
|
history
diff --git
a/src/iio/iio.c
b/src/iio/iio.c
index
1aee9fe
..
f15a337
100644
(file)
--- a/
src/iio/iio.c
+++ b/
src/iio/iio.c
@@
-599,6
+599,8
@@
mraa_iio_update_channels(mraa_iio_context dev)
if (read(fd, readbuf, 2 * sizeof(char)) != 2) {
syslog(LOG_ERR, "iio: Failed to read a sensible value from sysfs");
free(str);
+ close(fd);
+ closedir(dir);
return -1;
}
chan->enabled = (int) strtol(readbuf, NULL, 10);
@@
-617,8
+619,11
@@
mraa_iio_update_channels(mraa_iio_context dev)
}
}
}
+ closedir(dir);
+ return MRAA_SUCCESS;
}
- return MRAA_SUCCESS;
+
+ return MRAA_ERROR_INVALID_HANDLE;
}
mraa_result_t