]> code.delx.au - gnu-emacs/blobdiff - src/xgselect.c
Update copyright year to 2015
[gnu-emacs] / src / xgselect.c
index 4e2d1c8db69a5dcc563ef8d2cf1258c4b7752d5f..bb2226e07cf4f7b43c490ac9690571417412f94f 100644 (file)
@@ -1,6 +1,6 @@
 /* Function for handling the GLib event loop.
 
-Copyright (C) 2009-2014 Free Software Foundation, Inc.
+Copyright (C) 2009-2015 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -56,7 +56,7 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds,
   int gfds_size = ARRAYELTS (gfds_buf);
   int n_gfds, retval = 0, our_fds = 0, max_fds = fds_lim - 1;
   bool context_acquired = false;
-  int i, nfds, tmo_in_millisec = -1;
+  int i, nfds, tmo_in_millisec;
   bool need_to_dispatch;
   USE_SAFE_ALLOCA;
 
@@ -102,7 +102,7 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds,
 
   SAFE_FREE ();
 
-  if (tmo_in_millisec >= 0)
+  if (n_gfds >= 0 && tmo_in_millisec >= 0)
     {
       tmo = make_timespec (tmo_in_millisec / 1000,
                           1000 * 1000 * (tmo_in_millisec % 1000));