[Libguestfs] [PATCH v5] inspector: recognize ppc64 and ppc64le archs (RHBZ#1211996)

Richard W.M. Jones rjones at redhat.com
Thu May 28 11:52:17 UTC 2015


On Fri, May 22, 2015 at 05:10:14PM +0200, Maros Zatko wrote:
> @@ -145,7 +154,7 @@ magic_for_file (guestfs_h *g, const char *filename, bool *loading_ok,
>    if (loading_ok)
>      *loading_ok = true;
>  
> -  elf_arch = match1 (g, line, re_file_elf);
> +  match2 (g, line, re_file_elf, &endianness, &elf_arch);
>    if (elf_arch == NULL) {
>      error (g, "no re_file_elf match in '%s'", line);
>      return NULL;

I was a bit worried about not checking the return from match2, so I
applied this patch on top:

diff --git a/src/filearch.c b/src/filearch.c
index a309bbe..29c9ba6 100644
--- a/src/filearch.c
+++ b/src/filearch.c
@@ -154,8 +154,7 @@ magic_for_file (guestfs_h *g, const char *filename, bool *loading_ok,
   if (loading_ok)
     *loading_ok = true;
 
-  match2 (g, line, re_file_elf, &endianness, &elf_arch);
-  if (elf_arch == NULL) {
+  if (!match2 (g, line, re_file_elf, &endianness, &elf_arch)) {
     error (g, "no re_file_elf match in '%s'", line);
     return NULL;
   }

This is consistent with what the old code did, although I'm not 100%
convinced it is correct.

I pushed this, thanks.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list