Merge pull request #2367 from psychon/poll_save_errno

a_glib_poll: Preserve errno from g_poll()
This commit is contained in:
mergify[bot] 2018-08-26 16:40:06 +00:00 committed by GitHub
commit 69bb30181d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -410,6 +410,7 @@ a_glib_poll(GPollFD *ufds, guint nfsd, gint timeout)
guint res;
struct timeval now, length_time;
float length;
int saved_errno;
lua_State *L = globalconf_get_lua_State();
/* Do all deferred work now */
@ -440,8 +441,10 @@ a_glib_poll(GPollFD *ufds, guint nfsd, gint timeout)
/* Actually do the polling, record time of wakeup and check for new xcb events */
res = g_poll(ufds, nfsd, timeout);
saved_errno = errno;
gettimeofday(&last_wakeup, NULL);
a_xcb_check();
errno = saved_errno;
return res;
}