bug-hurd
[Top][All Lists]
Advanced

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

[PATCH] fix compiler warnings in hurd/boot


From: Flavio Cruz
Subject: [PATCH] fix compiler warnings in hurd/boot
Date: Tue, 29 Dec 2015 17:31:30 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

Lately, I've had the chance to cross-compile the hurd using gcc 5.3 and
I've decided to fix some compiler warnings I've noticed. I'll send the
patches for each sub-directory in separate emails.


boot: Fix boot.c compiler warning.

* boot/boot.c: Compare header without using pointer dereferencing.

diff --git a/boot/boot.c b/boot/boot.c
index f688860..4dda26b 100644
--- a/boot/boot.c
+++ b/boot/boot.c
@@ -243,7 +243,9 @@ load_image (task_t t,
     }
 
   read (fd, &hdr, sizeof hdr);
-  if (*(Elf32_Word *) hdr.e.e_ident == *(Elf32_Word *) "\177ELF")
+  /* File must have magic ELF number.  */
+  if (hdr.e.e_ident[0] == 0177 && hdr.e.e_ident[1] == 'E' &&
+      hdr.e.e_ident[2] == 'L' && hdr.e.e_ident[3] == 'F')
     {
       Elf32_Phdr phdrs[hdr.e.e_phnum], *ph;
       lseek (fd, hdr.e.e_phoff, SEEK_SET);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]