mirror of
https://github.com/upx/upx
synced 2025-09-28 19:06:07 +08:00
Option --assume-execute-permission
modified: main.cpp modified: options.h modified: p_unix.cpp https://github.com/upx/upx/issues/256
This commit is contained in:
parent
47ddace96a
commit
4484acf9d6
|
@ -872,6 +872,9 @@ static int do_option(int optc, const char *arg)
|
||||||
case 677:
|
case 677:
|
||||||
opt->o_unix.force_pie = true;
|
opt->o_unix.force_pie = true;
|
||||||
break;
|
break;
|
||||||
|
case 678:
|
||||||
|
opt->o_unix.assume_execute_permission = true;
|
||||||
|
break;
|
||||||
|
|
||||||
case '\0':
|
case '\0':
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -1024,6 +1027,7 @@ static const struct mfx_option longopts[] =
|
||||||
{"preserve-build-id", 0, 0, 675},
|
{"preserve-build-id", 0, 0, 675},
|
||||||
{"android-shlib", 0, 0, 676},
|
{"android-shlib", 0, 0, 676},
|
||||||
{"force-pie", 0, 0, 677},
|
{"force-pie", 0, 0, 677},
|
||||||
|
{"assume-execute-permission", 0, 0, 678},
|
||||||
// watcom/le
|
// watcom/le
|
||||||
{"le", 0x10, 0, 620}, // produce LE output
|
{"le", 0x10, 0, 620}, // produce LE output
|
||||||
// win32/pe
|
// win32/pe
|
||||||
|
|
|
@ -148,6 +148,7 @@ struct options_t {
|
||||||
bool preserve_build_id; // copy the build-id to the compressed binary
|
bool preserve_build_id; // copy the build-id to the compressed binary
|
||||||
bool android_shlib; // keep some ElfXX_Shdr for dlopen()
|
bool android_shlib; // keep some ElfXX_Shdr for dlopen()
|
||||||
bool force_pie; // choose DF_1_PIE instead of is_shlib
|
bool force_pie; // choose DF_1_PIE instead of is_shlib
|
||||||
|
bool assume_execute_permission; // do not check .st_mode for S_IXUSR
|
||||||
} o_unix;
|
} o_unix;
|
||||||
struct {
|
struct {
|
||||||
bool le;
|
bool le;
|
||||||
|
|
|
@ -63,11 +63,10 @@ bool PackUnix::canPack()
|
||||||
if (exetype == 0)
|
if (exetype == 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#if defined(__unix__) && !defined(__MSYS2__)
|
|
||||||
// must be executable by owner
|
// must be executable by owner
|
||||||
if ((fi->st.st_mode & S_IXUSR) == 0)
|
if (!opt->o_unix.assume_execute_permission // benefits __MSYS2__
|
||||||
|
&& (fi->st.st_mode & S_IXUSR) == 0)
|
||||||
throwCantPack("file not executable; try 'chmod +x'");
|
throwCantPack("file not executable; try 'chmod +x'");
|
||||||
#endif
|
|
||||||
if (file_size < 4096)
|
if (file_size < 4096)
|
||||||
throwCantPack("file is too small");
|
throwCantPack("file is too small");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user