tools:iio: save errno first
The man-page of errno states, that errno should be saved before doing any library call, as that call may have changed the value of errno. So, when encountering any error, save errno first. This patch affects generic_buffer.c, iio_event_monitor.c and iio_utils.c. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:

committed by
Jonathan Cameron

parent
f96d055e4b
commit
2b6a6e67af
@@ -296,8 +296,8 @@ int main(int argc, char **argv)
|
||||
/* Attempt to open non blocking the access dev */
|
||||
fp = open(buffer_access, O_RDONLY | O_NONBLOCK);
|
||||
if (fp == -1) { /* If it isn't there make the node */
|
||||
printf("Failed to open %s\n", buffer_access);
|
||||
ret = -errno;
|
||||
printf("Failed to open %s\n", buffer_access);
|
||||
goto error_free_buffer_access;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user