[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 3 of 3 RESEND] libxl: Warn that /usr/bin/pygrub is deprecated



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<george.dunlap@xxxxxxxxxxxxx>

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<termios.h>
+#include<string.h>

  #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

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.