mirror of
https://github.com/upx/upx.git
synced 2025-03-03 13:27:49 +00: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:
|
||||
opt->o_unix.force_pie = true;
|
||||
break;
|
||||
case 678:
|
||||
opt->o_unix.assume_execute_permission = true;
|
||||
break;
|
||||
|
||||
case '\0':
|
||||
return -1;
|
||||
@ -1024,6 +1027,7 @@ static const struct mfx_option longopts[] =
|
||||
{"preserve-build-id", 0, 0, 675},
|
||||
{"android-shlib", 0, 0, 676},
|
||||
{"force-pie", 0, 0, 677},
|
||||
{"assume-execute-permission", 0, 0, 678},
|
||||
// watcom/le
|
||||
{"le", 0x10, 0, 620}, // produce LE output
|
||||
// win32/pe
|
||||
|
@ -148,6 +148,7 @@ struct options_t {
|
||||
bool preserve_build_id; // copy the build-id to the compressed binary
|
||||
bool android_shlib; // keep some ElfXX_Shdr for dlopen()
|
||||
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;
|
||||
struct {
|
||||
bool le;
|
||||
|
@ -63,11 +63,10 @@ bool PackUnix::canPack()
|
||||
if (exetype == 0)
|
||||
return false;
|
||||
|
||||
#if defined(__unix__) && !defined(__MSYS2__)
|
||||
// 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'");
|
||||
#endif
|
||||
if (file_size < 4096)
|
||||
throwCantPack("file is too small");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user