From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47866) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLlEr-0000gO-4H for qemu-devel@nongnu.org; Wed, 11 Feb 2015 23:18:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YLlEm-0008Qo-5u for qemu-devel@nongnu.org; Wed, 11 Feb 2015 23:18:53 -0500 Received: from mail-pd0-f182.google.com ([209.85.192.182]:36019) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YLlEm-0008Qf-0i for qemu-devel@nongnu.org; Wed, 11 Feb 2015 23:18:48 -0500 Received: by pdjp10 with SMTP id p10so9182970pdj.3 for ; Wed, 11 Feb 2015 20:18:47 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Peter Maydell Date: Thu, 12 Feb 2015 04:18:26 +0000 Message-ID: Content-Type: text/plain; charset=UTF-8 Subject: Re: [Qemu-devel] [PATCH 1/4] gdbstub: Fix qOffsets packet detection List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Pedro Alves , qemu-devel , Fabien Chouteau , Jan Kiszka On 7 February 2015 at 08:38, Jan Kiszka wrote: > From: Jan Kiszka > > qOffsets has no additional optional parameters. So match the complete > string to avoid stumbling over possible future commands with identical > prefix. > > Signed-off-by: Jan Kiszka > --- > gdbstub.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gdbstub.c b/gdbstub.c > index e4a1a79..cd25d1a 100644 > --- a/gdbstub.c > +++ b/gdbstub.c > @@ -1107,7 +1107,7 @@ static int gdb_handle_packet(GDBState *s, const char *line_buf) > break; > } > #ifdef CONFIG_USER_ONLY > - else if (strncmp(p, "Offsets", 7) == 0) { > + else if (strcmp(p, "Offsets") == 0) { > TaskState *ts = s->c_cpu->opaque; > > snprintf(buf, sizeof(buf), We could write this as if (is_query_packet(p, "Offsets", 0)) but straight strcmp() works fine too. -- PMM