emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r116665: Fix "resource temporarily unavailable" with


From: Paul Eggert
Subject: [Emacs-diffs] trunk r116665: Fix "resource temporarily unavailable" with xgselect.
Date: Wed, 05 Mar 2014 06:32:11 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116665
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/16925
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2014-03-04 22:31:57 -0800
message:
  Fix "resource temporarily unavailable" with xgselect.
  
  * xgselect.c: Include <stdbool.h>.
  (xg_select) [!USE_GTK]: Don't lose track of errno.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/xgselect.c                 xgselect.c-20091121171556-bypaf8oo9ygoo13w-2
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-03-05 06:28:20 +0000
+++ b/src/ChangeLog     2014-03-05 06:31:57 +0000
@@ -1,5 +1,9 @@
 2014-03-05  Paul Eggert  <address@hidden>
 
+       Fix "resource temporarily unavailable" with xgselect (Bug#16925).
+       * xgselect.c: Include <stdbool.h>.
+       (xg_select) [!USE_GTK]: Don't lose track of errno.
+
        Fix minor --enable-gcc-warnings issues.
        * widget.c (update_various_frame_slots, EmacsFrameResize):
        Avoid unused locals.  Prefer 'if' to '#if' when either will do.

=== modified file 'src/xgselect.c'
--- a/src/xgselect.c    2014-02-04 11:40:31 +0000
+++ b/src/xgselect.c    2014-03-05 06:31:57 +0000
@@ -25,6 +25,7 @@
 
 #include <glib.h>
 #include <errno.h>
+#include <stdbool.h>
 #include <timespec.h>
 #include "frame.h"
 
@@ -43,6 +44,7 @@
   int gfds_size = sizeof gfds_buf / sizeof *gfds_buf;
   int n_gfds, retval = 0, our_fds = 0, max_fds = fds_lim - 1;
   int i, nfds, tmo_in_millisec;
+  bool need_to_dispatch;
   USE_SAFE_ALLOCA;
 
   /* Do not try to optimize with an initial check with g_main_context_pending
@@ -127,10 +129,17 @@
   /* If Gtk+ is in use eventually gtk_main_iteration will be called,
      unless retval is zero.  */
 #ifdef USE_GTK
-  if (retval == 0)
+  need_to_dispatch = retval == 0;
+#else
+  need_to_dispatch = true;
 #endif
-    while (g_main_context_pending (context))
-      g_main_context_dispatch (context);
+  if (need_to_dispatch)
+    {
+      int pselect_errno = errno;
+      while (g_main_context_pending (context))
+       g_main_context_dispatch (context);
+      errno = pselect_errno;
+    }
 
   /* To not have to recalculate timeout, return like this.  */
   if ((our_fds > 0 || (nfds == 0 && tmop == &tmo)) && (retval == 0))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]