diff options
author | Corinna Vinschen <corinna@vinschen.de> | 2011-01-19 12:15:17 +0300 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2011-01-19 12:15:17 +0300 |
commit | 808aae3d13971fd7ccb474caff9bd89a9569795b (patch) | |
tree | cd8f1261c8db43844af1c02ecc5853daa172ccb6 /winsup/cygwin/winf.h | |
parent | fc660168bf056b96c6825d3a4ef97b75261577d5 (diff) |
* errno.cc (errmap): Add error codes for invalid binaries.
* exec.cc (execvp): Call spawnve with _P_PATH_TYPE_EXEC flag
from here.
(execvpe): Ditto.
* spawn.cc (spawn_guts): Filter _P_PATH_TYPE_EXEC from mode and
store in p_type_exec. Call av::fixup with addtional p_type_exec
argument.
(spawnve): Check for filtered mode.
(spawnvpe): Add _P_PATH_TYPE_EXEC flag when calling spawnve.
(av::fixup): Accept additional bool parameter p_type_exec. Only check
for script if p_type_exec is true.
* winf.h (_P_PATH_TYPE_EXEC): Define.
(_P_MODE): Define.
(av::fixup): Declare with additional bool parameter.
Diffstat (limited to 'winsup/cygwin/winf.h')
-rw-r--r-- | winsup/cygwin/winf.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/winsup/cygwin/winf.h b/winsup/cygwin/winf.h index a58fb49a9..dccaf5b32 100644 --- a/winsup/cygwin/winf.h +++ b/winsup/cygwin/winf.h @@ -1,6 +1,6 @@ /* winf.h - Copyright 2006, 2007 Red Hat, Inc. + Copyright 2006, 2007, 2011 Red Hat, Inc. This software is a copyrighted work licensed under the terms of the Cygwin license. Please consult the file "CYGWIN_LICENSE" for @@ -20,6 +20,16 @@ details. */ #define MAXWINCMDLEN 32767 #define LINE_BUF_CHUNK (MAX_PATH * 2) +/* Add this flag in calls to spawn_guts if the calling function is one of + 'p' type functions: execlp, execvp, spawnlp, spawnvp. Per POSIX, only + these p-type functions fall back to call /bin/sh if the file is not a + binary. The setting of _P_PATH_TYPE_EXEC is used as a bool value in + av::fixup to decide if the file should be evaluated as a script, or if + ENOEXEC should be returned. */ +#define _P_PATH_TYPE_EXEC 0x100 +/* Helper macro to mask actual mode and drop additional flags defined above. */ +#define _P_MODE(x) ((x) & 0xff) + class av { char **argv; @@ -67,7 +77,7 @@ class av for (int i = calloced; i < argc; i++) argv[i] = cstrdup1 (argv[i]); } - int fixup (const char *, path_conv&, const char *); + int fixup (const char *, path_conv&, const char *, bool); }; class linebuf |