diff options
author | Hartmut Knaack <knaack.h@gmx.de> | 2015-05-31 14:39:48 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2015-05-31 17:32:44 +0100 |
commit | 2b6a6e67af6f8f644a48f75efc1f44544c0d74f6 (patch) | |
tree | ffff341e8cdb92e06abd46628219495c5c2e7066 /tools/iio/generic_buffer.c | |
parent | f96d055e4b38c64123f211f0521f834d649cd01c (diff) | |
download | blackbird-op-linux-2b6a6e67af6f8f644a48f75efc1f44544c0d74f6.tar.gz blackbird-op-linux-2b6a6e67af6f8f644a48f75efc1f44544c0d74f6.zip |
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>
Diffstat (limited to 'tools/iio/generic_buffer.c')
-rw-r--r-- | tools/iio/generic_buffer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/iio/generic_buffer.c b/tools/iio/generic_buffer.c index 0410948e23c2..7635aeb93dc8 100644 --- a/tools/iio/generic_buffer.c +++ b/tools/iio/generic_buffer.c @@ -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; } |