From 0df67e67992afa5a1a27b145163c69f202897fab Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Mon, 25 Jul 2022 13:42:09 +0200 Subject: libgamepad_open_superdevice.c: do not change errno on success MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- libgamepad_open_superdevice.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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: -- cgit v1.2.3-70-g09d2