aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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: