Pack shell scripts for Linux only (and not *BSD, for example [no stub!])
This commit is contained in:
+13
-10
@@ -55,12 +55,13 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
PackLinuxI386::PackLinuxI386(InputFile *f) : super(f),
|
PackLinuxI386::PackLinuxI386(InputFile *f) : super(f),
|
||||||
ei_osabi(0), osabi_note(NULL)
|
ei_osabi(Elf32_Ehdr::ELFOSABI_LINUX), osabi_note(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
PackBSDI386::PackBSDI386(InputFile *f) : super(f)
|
PackBSDI386::PackBSDI386(InputFile *f) : super(f)
|
||||||
{
|
{
|
||||||
|
ei_osabi = 0; // not ELFOSABI_LINUX
|
||||||
}
|
}
|
||||||
|
|
||||||
static const
|
static const
|
||||||
@@ -560,15 +561,17 @@ bool PackLinuxI386::canPack()
|
|||||||
// FIXME: N_TRSIZE, N_DRSIZE
|
// FIXME: N_TRSIZE, N_DRSIZE
|
||||||
// FIXME: check for aout shared libraries
|
// FIXME: check for aout shared libraries
|
||||||
}
|
}
|
||||||
#if defined(__linux__)
|
else { // shell scripts and other interpreters
|
||||||
// only compress scripts when running under Linux
|
if (Elf32_Ehdr::ELFOSABI_LINUX!=ei_osabi) {
|
||||||
else if (!memcmp(buf, "#!/", 3)) // #!/bin/sh
|
return false; // so far, only Linux has runtime stub for shell
|
||||||
exetype = -1;
|
}
|
||||||
else if (!memcmp(buf, "#! /", 4)) // #! /bin/sh
|
else if (!memcmp(buf, "#!/", 3)) // #!/bin/sh
|
||||||
exetype = -1;
|
exetype = -1;
|
||||||
else if (!memcmp(buf, "\xca\xfe\xba\xbe", 4)) // Java bytecode
|
else if (!memcmp(buf, "#! /", 4)) // #! /bin/sh
|
||||||
exetype = -2;
|
exetype = -1;
|
||||||
#endif
|
else if (!memcmp(buf, "\xca\xfe\xba\xbe", 4)) // Java bytecode
|
||||||
|
exetype = -2;
|
||||||
|
}
|
||||||
|
|
||||||
return super::canPack();
|
return super::canPack();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user