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

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