add O_MAYEXEC support for CLIP OS, zero cost otherwise
cf. https://lwn.net/Articles/768819/
This commit is contained in:
parent
8e4829bc5f
commit
dddf3694e9
4
exec.c
4
exec.c
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.202 2018/10/07 01:10:11 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.203 2018/10/30 17:10:14 tg Exp $");
|
||||
|
||||
#ifndef MKSH_DEFAULT_EXECSHELL
|
||||
#define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh"
|
||||
|
@ -886,7 +886,7 @@ scriptexec(struct op *tp, const char **ap)
|
|||
*tp->args-- = tp->str;
|
||||
|
||||
#ifndef MKSH_SMALL
|
||||
if ((fd = binopen2(tp->str, O_RDONLY)) >= 0) {
|
||||
if ((fd = binopen2(tp->str, O_RDONLY | O_MAYEXEC)) >= 0) {
|
||||
unsigned char *cp;
|
||||
#ifndef MKSH_EBCDIC
|
||||
unsigned short m;
|
||||
|
|
6
main.c
6
main.c
|
@ -34,7 +34,7 @@
|
|||
#include <locale.h>
|
||||
#endif
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.349 2018/05/08 17:37:36 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.350 2018/10/30 17:10:15 tg Exp $");
|
||||
|
||||
#ifndef MKSHRC_PATH
|
||||
#define MKSHRC_PATH "~/.mkshrc"
|
||||
|
@ -513,7 +513,7 @@ main_init(int argc, const char *argv[], Source **sp, struct block **lp)
|
|||
#else
|
||||
s->file = argv[argi++];
|
||||
#endif
|
||||
s->u.shf = shf_open(s->file, O_RDONLY, 0,
|
||||
s->u.shf = shf_open(s->file, O_RDONLY | O_MAYEXEC, 0,
|
||||
SHF_MAPHI | SHF_CLEXEC);
|
||||
if (s->u.shf == NULL) {
|
||||
shl_stdout_ok = false;
|
||||
|
@ -713,7 +713,7 @@ include(const char *name, int argc, const char **argv, bool intr_ok)
|
|||
volatile int old_argc;
|
||||
int i;
|
||||
|
||||
shf = shf_open(name, O_RDONLY, 0, SHF_MAPHI | SHF_CLEXEC);
|
||||
shf = shf_open(name, O_RDONLY | O_MAYEXEC, 0, SHF_MAPHI | SHF_CLEXEC);
|
||||
if (shf == NULL)
|
||||
return (-1);
|
||||
|
||||
|
|
6
sh.h
6
sh.h
|
@ -182,7 +182,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef EXTERN
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.866 2018/10/20 18:45:58 tg Exp $");
|
||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.867 2018/10/30 17:10:16 tg Exp $");
|
||||
#endif
|
||||
#define MKSH_VERSION "R56 2018/10/20"
|
||||
|
||||
|
@ -491,6 +491,10 @@ extern int __cdecl setegid(gid_t);
|
|||
#define O_BINARY 0
|
||||
#endif
|
||||
|
||||
#ifndef O_MAYEXEC
|
||||
#define O_MAYEXEC 0
|
||||
#endif
|
||||
|
||||
#ifdef MKSH__NO_SYMLINK
|
||||
#undef S_ISLNK
|
||||
#define S_ISLNK(m) (/* CONSTCOND */ 0)
|
||||
|
|
Loading…
Reference in New Issue