From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Dunlap Subject: Re: [PATCH 3 of 3 RESEND] libxl: Warn that /usr/bin/pygrub is deprecated Date: Wed, 9 May 2012 15:48:08 +0100 Message-ID: <4FAA83A8.8070804@eu.citrix.com> References: <794778a6e9fa761bd388.1336560666@kodo2> <1336570982.25514.120.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1336570982.25514.120.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org On 09/05/12 14:43, Ian Campbell wrote: > On Wed, 2012-05-09 at 11:51 +0100, George Dunlap wrote: >> Signed-off-by: George Dunlap >> >> diff -r 52f45b258ccc -r 794778a6e9fa tools/libxl/libxl_bootloader.c >> --- a/tools/libxl/libxl_bootloader.c Wed May 09 11:39:43 2012 +0100 >> +++ b/tools/libxl/libxl_bootloader.c Wed May 09 11:42:19 2012 +0100 >> @@ -15,6 +15,7 @@ >> #include "libxl_osdeps.h" /* must come before any other headers */ >> >> #include >> +#include >> >> #include "libxl_internal.h" >> >> @@ -398,6 +399,11 @@ int libxl_run_bootloader(libxl_ctx *ctx, >> goto out_close; >> } >> >> + if ( !strncmp(info->u.pv.bootloader, "/usr/bin/pygrub", 20) ) > Why strncmp and not just strcmp? And why 20? AFAIK > strlen("/usr/bin/pygrub") == 15 or 16 or so... ISTR in the past build processes throwing warnings that strcmp() is unsafe, and since warnings turn to errors, pre-emptively used the "safe" version instead. Let me give it a try; it should be perfectly safe for us, and will remove the issue with manually syncronizing string with its size. -George