summaryrefslogtreecommitdiffstats
path: root/sys/kern/imgact_aout.c
diff options
context:
space:
mode:
authorpeter <peter@FreeBSD.org>1996-03-03 20:06:53 +0000
committerpeter <peter@FreeBSD.org>1996-03-03 20:06:53 +0000
commitcda4a6ceba724cde233d6ee3ab68f77e1e22ad10 (patch)
tree253ecc61ca7e59148f424853c4028f2fce95f4d3 /sys/kern/imgact_aout.c
parent112db21947e424c386cd9c5516fde237cc1d61d0 (diff)
downloadFreeBSD-src-cda4a6ceba724cde233d6ee3ab68f77e1e22ad10.zip
FreeBSD-src-cda4a6ceba724cde233d6ee3ab68f77e1e22ad10.tar.gz
Deal with NetBSD byte-swapped a.out magic when checking the MID to exclude
linux binaries from the *BSD a.out loader. This is a hack, but lets me run static NetBSD binaries. Dynamic binaries are a much bigger problem because the shared libraries would conflict with our native libraries, so a /compat/netbsd alternate namespace and translation would be needed.
Diffstat (limited to 'sys/kern/imgact_aout.c')
-rw-r--r--sys/kern/imgact_aout.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/imgact_aout.c b/sys/kern/imgact_aout.c
index d183a22..b369df1 100644
--- a/sys/kern/imgact_aout.c
+++ b/sys/kern/imgact_aout.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: imgact_aout.c,v 1.22 1996/01/19 03:57:54 dyson Exp $
+ * $Id: imgact_aout.c,v 1.23 1996/03/02 19:38:06 peter Exp $
*/
#include <sys/param.h>
@@ -66,9 +66,11 @@ exec_aout_imgact(imgp)
* Linux and *BSD binaries look very much alike,
* only the machine id is different:
* 0x64 for Linux, 0x86 for *BSD, 0x00 for BSDI.
+ * NetBSD is in network byte order.. ugh.
*/
if (((a_out->a_magic >> 16) & 0xff) != 0x86 &&
- ((a_out->a_magic >> 16) & 0xff) != 0)
+ ((a_out->a_magic >> 16) & 0xff) != 0 &&
+ ((((int)ntohl(a_out->a_magic)) >> 16) & 0xff) != 0x86)
return -1;
/*
OpenPOWER on IntegriCloud