summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2006-06-10 18:24:32 +0000
committerDaniel Jacobowitz <dan@debian.org>2006-06-10 18:24:32 +0000
commit4448f409caddd190122ca2078f2172513333611b (patch)
treec6e348df763b042d2fa947b3c9bf6a129b0063af
parentb22cc3b1dd0975d5e9c6b45165b8a3a313bf789a (diff)
downloadgdb-4448f409caddd190122ca2078f2172513333611b.tar.gz
* mingw-hdep.c (gdb_select): Always check for NULL fd sets
before calling FD_ISSET. Correct check for exceptfds which previously tested writefds.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/mingw-hdep.c15
2 files changed, 14 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 75a39ab81f5..3ddea3cc524 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+2006-06-10 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * mingw-hdep.c (gdb_select): Always check for NULL fd sets
+ before calling FD_ISSET. Correct check for exceptfds which
+ previously tested writefds.
+
2006-06-09 Daniel Jacobowitz <dan@codesourcery.com>
Julian Brown <julian@codesourcery.com>
diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index bb0f50aaa46..2b92a1ce2f8 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -105,8 +105,8 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
if something starts using it. */
gdb_assert (!writefds || !FD_ISSET (fd, writefds));
- if (!FD_ISSET (fd, readfds)
- && !FD_ISSET (fd, exceptfds))
+ if ((!readfds || !FD_ISSET (fd, readfds))
+ && (!exceptfds || !FD_ISSET (fd, exceptfds)))
continue;
h = (HANDLE) _get_osfhandle (fd);
@@ -124,13 +124,13 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
except = never_handle;
}
- if (FD_ISSET (fd, readfds))
+ if (readfds && FD_ISSET (fd, readfds))
{
gdb_assert (num_handles < MAXIMUM_WAIT_OBJECTS);
handles[num_handles++] = read;
}
- if (FD_ISSET (fd, exceptfds))
+ if (exceptfds && FD_ISSET (fd, exceptfds))
{
gdb_assert (num_handles < MAXIMUM_WAIT_OBJECTS);
handles[num_handles++] = except;
@@ -169,10 +169,11 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
HANDLE fd_h;
struct serial *scb;
- if (!FD_ISSET (fd, readfds) && !FD_ISSET (fd, writefds))
+ if ((!readfds || !FD_ISSET (fd, readfds))
+ && (!exceptfds || !FD_ISSET (fd, exceptfds)))
continue;
- if (FD_ISSET (fd, readfds))
+ if (readfds && FD_ISSET (fd, readfds))
{
fd_h = handles[indx++];
/* This handle might be ready, even though it wasn't the handle
@@ -183,7 +184,7 @@ gdb_select (int n, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
num_ready++;
}
- if (FD_ISSET (fd, exceptfds))
+ if (exceptfds && FD_ISSET (fd, exceptfds))
{
fd_h = handles[indx++];
/* This handle might be ready, even though it wasn't the handle