Blame SOURCES/gdb-rhbz1186918-gdbserver-in-container-1of8.patch

0b42f8
commit e7f0d979dd5cc4f8b658df892e93db69d6d660b7
0b42f8
Author: Yao Qi <yao@codesourcery.com>
0b42f8
Date:   Tue Dec 10 21:59:20 2013 +0800
0b42f8
0b42f8
    Fix a bug in matching notifications.
0b42f8
    
0b42f8
    Due to copy-n-paste, the problem caused PR remote/15974 also exists
0b42f8
    in gdbserver.  This patch fixes it in the same way.  Patch to fix
0b42f8
    remote/15974 can be found:
0b42f8
    
0b42f8
      https://sourceware.org/ml/gdb-patches/2013-12/msg00014.html
0b42f8
    
0b42f8
    gdb/gdbserver:
0b42f8
    
0b42f8
    2013-12-11  Yao Qi  <yao@codesourcery.com>
0b42f8
    
0b42f8
    	* notif.c (handle_notif_ack): Return 0 if no notification
0b42f8
    	matches.
0b42f8
0b42f8
### a/gdb/gdbserver/ChangeLog
0b42f8
### b/gdb/gdbserver/ChangeLog
0b42f8
## -1,3 +1,8 @@
0b42f8
+2013-12-11  Yao Qi  <yao@codesourcery.com>
0b42f8
+
0b42f8
+	* notif.c (handle_notif_ack): Return 0 if no notification
0b42f8
+	matches.
0b42f8
+
0b42f8
 2013-11-20  Doug Evans  <dje@google.com>
0b42f8
 
0b42f8
 	* linux-low.c (linux_set_resume_request): Fix comment.
0b42f8
--- a/gdb/gdbserver/notif.c
0b42f8
+++ b/gdb/gdbserver/notif.c
0b42f8
@@ -78,20 +78,23 @@ notif_write_event (struct notif_server *notif, char *own_buf)
0b42f8
 int
0b42f8
 handle_notif_ack (char *own_buf, int packet_len)
0b42f8
 {
0b42f8
-  int i = 0;
0b42f8
-  struct notif_server *np = NULL;
0b42f8
+  size_t i;
0b42f8
+  struct notif_server *np;
0b42f8
 
0b42f8
   for (i = 0; i < ARRAY_SIZE (notifs); i++)
0b42f8
     {
0b42f8
-      np = notifs[i];
0b42f8
-      if (strncmp (own_buf, np->ack_name, strlen (np->ack_name)) == 0
0b42f8
-	  && packet_len == strlen (np->ack_name))
0b42f8
+      const char *ack_name = notifs[i]->ack_name;
0b42f8
+
0b42f8
+      if (strncmp (own_buf, ack_name, strlen (ack_name)) == 0
0b42f8
+	  && packet_len == strlen (ack_name))
0b42f8
 	break;
0b42f8
     }
0b42f8
 
0b42f8
-  if (np == NULL)
0b42f8
+  if (i == ARRAY_SIZE (notifs))
0b42f8
     return 0;
0b42f8
 
0b42f8
+  np = notifs[i];
0b42f8
+
0b42f8
   /* If we're waiting for GDB to acknowledge a pending event,
0b42f8
      consider that done.  */
0b42f8
   if (!QUEUE_is_empty (notif_event_p, np->queue))