From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20307 invoked by alias); 10 Jan 2006 22:22:28 -0000 Received: (qmail 20300 invoked by uid 22791); 10 Jan 2006 22:22:28 -0000 X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO sibelius.xs4all.nl) (82.92.89.47) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 10 Jan 2006 22:22:26 +0000 Received: from elgar.sibelius.xs4all.nl (root@elgar.sibelius.xs4all.nl [192.168.0.2]) by sibelius.xs4all.nl (8.13.4/8.13.4) with ESMTP id k0AMMNU7015279 for ; Tue, 10 Jan 2006 23:22:23 +0100 (CET) Received: from elgar.sibelius.xs4all.nl (kettenis@localhost.sibelius.xs4all.nl [127.0.0.1]) by elgar.sibelius.xs4all.nl (8.13.4/8.13.3) with ESMTP id k0AMMNo8007721 for ; Tue, 10 Jan 2006 23:22:23 +0100 (CET) Received: (from kettenis@localhost) by elgar.sibelius.xs4all.nl (8.13.4/8.13.4/Submit) id k0AMMNSq000979; Tue, 10 Jan 2006 23:22:23 +0100 (CET) Date: Tue, 10 Jan 2006 22:22:00 -0000 Message-Id: <200601102222.k0AMMNSq000979@elgar.sibelius.xs4all.nl> From: Mark Kettenis To: gdb-patches@sourceware.org Subject: [RFC] Fix compiler warnings in osabi.c Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-01/txt/msg00105.txt.bz2 Another GCC 4 warning; e_ident[] is an array of unsigned chars. I think the most elegant way to solve this is to use memcmp instead of strcmp, since we're comparing a string to what may be random garbage, and not two strings. This one isn't quite so obvious, but if nobody objects, I'll commit this after a week. Mark Index: ChangeLog from Mark Kettenis * osabi.c (generic_elf_osabi_sniffer): Use memcmp instead of strcmp to compare string to an arbitrary buffer. Index: osabi.c =================================================================== RCS file: /cvs/src/src/gdb/osabi.c,v retrieving revision 1.34 diff -u -p -r1.34 osabi.c --- osabi.c 17 Dec 2005 22:34:01 -0000 1.34 +++ osabi.c 10 Jan 2006 22:18:43 -0000 @@ -546,7 +546,7 @@ generic_elf_osabi_sniffer (bfd *abfd) /* The FreeBSD folks have been naughty; they stored the string "FreeBSD" in the padding of the e_ident field of the ELF header to "brand" their ELF binaries in FreeBSD 3.x. */ - if (strcmp (&elf_elfheader (abfd)->e_ident[8], "FreeBSD") == 0) + if (memcmp (&elf_elfheader (abfd)->e_ident[8], "FreeBSD", 8) == 0) osabi = GDB_OSABI_FREEBSD_ELF; }