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

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