mirror of
https://gitlab.freedesktop.org/libinput/libinput.git
synced 2026-02-04 19:50:25 +01:00
pad: don't clobber the errno if the pad led failed to initialize
pad_led_destroy() may call something that sets errno, so let's protect against that. Part-of: <https://gitlab.freedesktop.org/libinput/libinput/-/merge_requests/1070>
This commit is contained in:
parent
181c667266
commit
7ae4fabb76
1 changed files with 3 additions and 1 deletions
|
|
@ -104,7 +104,7 @@ pad_led_new(struct libinput *libinput, const char *prefix, int group, int mode)
|
|||
{
|
||||
struct pad_mode_led *led;
|
||||
char path[PATH_MAX];
|
||||
int rc, fd;
|
||||
int rc, fd, save_errno;
|
||||
|
||||
led = zalloc(sizeof *led);
|
||||
led->brightness_fd = -1;
|
||||
|
|
@ -133,7 +133,9 @@ pad_led_new(struct libinput *libinput, const char *prefix, int group, int mode)
|
|||
return led;
|
||||
|
||||
error:
|
||||
save_errno = errno;
|
||||
pad_led_destroy(libinput, led);
|
||||
errno = save_errno;
|
||||
return NULL;
|
||||
}
|
||||
#endif /* HAVE_LIBWACOM */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue