aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-07-25 13:42:09 +0200
committerMattias Andrée <maandree@kth.se>2022-07-25 13:42:09 +0200
commit0df67e67992afa5a1a27b145163c69f202897fab (patch)
treef3a658e571e50ba146d586df9db11d1ad42e0ed4
parentm (diff)
downloadlibgamepad-0df67e67992afa5a1a27b145163c69f202897fab.tar.gz
libgamepad-0df67e67992afa5a1a27b145163c69f202897fab.tar.bz2
libgamepad-0df67e67992afa5a1a27b145163c69f202897fab.tar.xz
libgamepad_open_superdevice.c: do not change errno on success
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--libgamepad_open_superdevice.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libgamepad_open_superdevice.c b/libgamepad_open_superdevice.c
index b6b975f..2290840 100644
--- a/libgamepad_open_superdevice.c
+++ b/libgamepad_open_superdevice.c
@@ -12,7 +12,7 @@ libgamepad_open_superdevice(struct libgamepad_superdevice *devicep, const char *
enum libgamepad_type type;
size_t first = 0, len;
void *new;
- int saved_errno;
+ int saved_errno = errno;
devicep->ndevices = 0;
devicep->devices = NULL;
@@ -126,6 +126,7 @@ libgamepad_open_superdevice(struct libgamepad_superdevice *devicep, const char *
}
close(dirfd);
+ errno = saved_errno;
return 0;
fail: