Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/freebsd Add a comment regarding the ELFOSABI_FREE...



details:   https://anonhg.NetBSD.org/src/rev/f3d276f6b274
branches:  trunk
changeset: 516662:f3d276f6b274
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Oct 27 09:50:22 2001 +0000

description:
Add a comment regarding the ELFOSABI_FREEBSD thing,
and reformat the condition a bit to avoid nested if

diffstat:

 sys/compat/freebsd/freebsd_exec_elf32.c |  17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r 8d315cb3eae5 -r f3d276f6b274 sys/compat/freebsd/freebsd_exec_elf32.c
--- a/sys/compat/freebsd/freebsd_exec_elf32.c   Sat Oct 27 08:16:17 2001 +0000
+++ b/sys/compat/freebsd/freebsd_exec_elf32.c   Sat Oct 27 09:50:22 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: freebsd_exec_elf32.c,v 1.4 2001/10/23 16:43:33 christos Exp $  */
+/*     $NetBSD: freebsd_exec_elf32.c,v 1.5 2001/10/27 09:50:22 jdolecek Exp $  */
 
 /*
  * Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -66,14 +66,19 @@
         static const char wantBrand[] = FREEBSD_ELF_BRAND_STRING;
         static const char wantInterp[] = FREEBSD_ELF_INTERP_PREFIX_STRING;
 
-        /* Insist that the executable have a brand, and that it be "FreeBSD" */
+        /*
+        * Insist that the executable have a brand, and that it be "FreeBSD".
+        * Newer FreeBSD binaries have OSABI set to ELFOSABI_FREEBSD. This
+        * is arguably broken, but they seem to think they need it, for
+        * whatever reason.
+        */
 #ifndef EI_BRAND
 #define EI_BRAND 8
 #endif
-        if (eh->e_ident[EI_BRAND] == '\0'
-           || strcmp(&eh->e_ident[EI_BRAND], wantBrand))
-               if (eh->e_ident[EI_OSABI] != ELFOSABI_FREEBSD)
-                       return ENOEXEC;
+        if ((eh->e_ident[EI_BRAND] == '\0'
+               || strcmp(&eh->e_ident[EI_BRAND], wantBrand) != 0)
+           && eh->e_ident[EI_OSABI] != ELFOSABI_FREEBSD)
+               return ENOEXEC;
 
        i = eh->e_phnum;
        if (i != 0) {



Home | Main Index | Thread Index | Old Index