diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 62abbaca43..e7998b9aa6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2013-12-02 Pedro Alves + + PR remote/15974 + * remote-notif.c (handle_notification): Return early if no + notification is found. + 2013-12-02 Joel Brobecker * common/filestuff.c (fdwalk): Add "defined(RLIMIT_NOFILE)" diff --git a/gdb/remote-notif.c b/gdb/remote-notif.c index 0d5927912b..163979d211 100644 --- a/gdb/remote-notif.c +++ b/gdb/remote-notif.c @@ -127,22 +127,25 @@ remote_async_get_pending_events_handler (gdb_client_data data) void handle_notification (struct remote_notif_state *state, char *buf) { - struct notif_client *nc = NULL; - int i; + struct notif_client *nc; + size_t i; for (i = 0; i < ARRAY_SIZE (notifs); i++) { - nc = notifs[i]; - if (strncmp (buf, nc->name, strlen (nc->name)) == 0 - && buf[strlen (nc->name)] == ':') + const char *name = notifs[i]->name; + + if (strncmp (buf, name, strlen (name)) == 0 + && buf[strlen (name)] == ':') break; } /* We ignore notifications we don't recognize, for compatibility with newer stubs. */ - if (nc == NULL) + if (i == ARRAY_SIZE (notifs)) return; + nc = notifs[i]; + if (state->pending_event[nc->id] != NULL) { /* We've already parsed the in-flight reply, but the stub for some