Source-Changes-HG archive

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

[src/netbsd-1-5]: src/sys/compat/freebsd Apply patch (requested by jonathan):



details:   https://anonhg.NetBSD.org/src/rev/213e2387c9fd
branches:  netbsd-1-5
changeset: 492938:213e2387c9fd
user:      he <he%NetBSD.org@localhost>
date:      Thu Mar 07 18:02:18 2002 +0000

description:
Apply patch (requested by jonathan):
  Recognize FreeBSD ELFOSABI marked executables.
Patch is revisions 1.3-1.5 of freebsd_exec_elf32.c (new after branch)

diffstat:

 sys/compat/freebsd/freebsd_exec.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 5595acb72f29 -r 213e2387c9fd sys/compat/freebsd/freebsd_exec.c
--- a/sys/compat/freebsd/freebsd_exec.c Thu Mar 07 17:59:45 2002 +0000
+++ b/sys/compat/freebsd/freebsd_exec.c Thu Mar 07 18:02:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: freebsd_exec.c,v 1.5 1999/10/25 13:55:07 kleink Exp $  */
+/*     $NetBSD: freebsd_exec.c,v 1.5.6.1 2002/03/07 18:02:18 he Exp $  */
 
 /*
  * Copyright (c) 1993, 1994 Christopher G. Demetriou
@@ -110,12 +110,18 @@
         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_BRAND] == '\0'
+               || strcmp(&eh->e_ident[EI_BRAND], wantBrand) != 0)
+           && eh->e_ident[EI_OSABI] != ELFOSABI_FREEBSD)
                return ENOEXEC;
 
        i = eh->e_phnum;



Home | Main Index | Thread Index | Old Index