OSDN Git Service

* exec.cc: Include pinfo.h.
authorcorinna <corinna>
Thu, 20 Jan 2011 20:09:21 +0000 (20:09 +0000)
committercorinna <corinna>
Thu, 20 Jan 2011 20:09:21 +0000 (20:09 +0000)
* winf.h: Move definitions of _P_PATH_TYPE_EXEC and _P_MODE from here...
* pinfo.h: ...to here.
(_P_PATH_TYPE_EXEC): Redefine to be bigger than _P_SYSTEM.
(_P_MODE): Redefine so as not to mask out _P_SYSTEM.
* spawn.cc (spawnlp): Add _P_PATH_TYPE_EXEC flag in call to spawnve.
(spawnlpe): Ditto.
(spawnvp): Ditto.

winsup/cygwin/ChangeLog
winsup/cygwin/exec.cc
winsup/cygwin/pinfo.h
winsup/cygwin/spawn.cc
winsup/cygwin/winf.h

index ca31e51..c6ebe1d 100644 (file)
@@ -1,3 +1,14 @@
+2011-01-20  Corinna Vinschen  <corinna@vinschen.de>
+
+       * exec.cc: Include pinfo.h.
+       * winf.h: Move definitions of _P_PATH_TYPE_EXEC and _P_MODE from here...
+       * pinfo.h: ...to here.
+       (_P_PATH_TYPE_EXEC): Redefine to be bigger than _P_SYSTEM.
+       (_P_MODE): Redefine so as not to mask out _P_SYSTEM.
+       * spawn.cc (spawnlp): Add _P_PATH_TYPE_EXEC flag in call to spawnve.
+       (spawnlpe): Ditto.
+       (spawnvp): Ditto.
+
 2011-01-19  Corinna Vinschen  <corinna@vinschen.de>
 
        * spawn.cc (av::fixup): Reenable #! handling for all exec functions.
index e5d3747..2ec298f 100644 (file)
@@ -16,6 +16,7 @@ details. */
 #include "sync.h"
 #include "fhandler.h"
 #include "dtable.h"
+#include "pinfo.h"
 #include "cygheap.h"
 #include "winf.h"
 
index bc29409..bc3d3a5 100644 (file)
@@ -1,7 +1,7 @@
 /* pinfo.h: process table info
 
-   Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
-   Red Hat, Inc.
+   Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
+   2011 Red Hat, Inc.
 
 This file is part of Cygwin.
 
@@ -226,6 +226,16 @@ extern pinfo myself;
 
 #define _P_VFORK 0
 #define _P_SYSTEM 512
+/* 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      0x1000
+
+/* Helper macro to mask actual mode and drop additional flags defined above. */
+#define _P_MODE(x)             ((x) & 0xfff)
 
 #define __ctty() _ctty ((char *) alloca (sizeof ("ctty /dev/tty") + 20))
 #define myctty() myself->__ctty ()
index 5f97f41..1b268e4 100644 (file)
@@ -969,8 +969,8 @@ spawnlp (int mode, const char *file, const char *arg0, ...)
 
   va_end (args);
 
-  return spawnve (mode, find_exec (file, buf), (char * const *) argv,
-                 cur_environ ());
+  return spawnve (mode | _P_PATH_TYPE_EXEC, find_exec (file, buf),
+                 (char * const *) argv, cur_environ ());
 }
 
 extern "C" int
@@ -993,7 +993,8 @@ spawnlpe (int mode, const char *file, const char *arg0, ...)
   envp = va_arg (args, const char * const *);
   va_end (args);
 
-  return spawnve (mode, find_exec (file, buf), (char * const *) argv, envp);
+  return spawnve (mode | _P_PATH_TYPE_EXEC, find_exec (file, buf),
+                 (char * const *) argv, envp);
 }
 
 extern "C" int
@@ -1006,7 +1007,8 @@ extern "C" int
 spawnvp (int mode, const char *file, const char * const *argv)
 {
   path_conv buf;
-  return spawnve (mode, find_exec (file, buf), argv, cur_environ ());
+  return spawnve (mode | _P_PATH_TYPE_EXEC, find_exec (file, buf), argv,
+                 cur_environ ());
 }
 
 extern "C" int
index dccaf5b..55bedac 100644 (file)
@@ -20,16 +20,6 @@ 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;