OSDN Git Service

* fold-const.c: Remove prototypes for native_encode_expr and
[pf3gnuchains/gcc-fork.git] / libiberty / pex-djgpp.c
index b452f46..ac5a4f9 100644 (file)
@@ -45,7 +45,8 @@ extern int errno;
 static int pex_djgpp_open_read (struct pex_obj *, const char *, int);
 static int pex_djgpp_open_write (struct pex_obj *, const char *, int);
 static long pex_djgpp_exec_child (struct pex_obj *, int, const char *,
-                                 char * const *, int, int, int,
+                                 char * const *, char * const *,
+                                 int, int, int, int,
                                  const char **, int *);
 static int pex_djgpp_close (struct pex_obj *, int);
 static int pex_djgpp_wait (struct pex_obj *, long, int *, struct pex_time *,
@@ -62,6 +63,7 @@ const struct pex_funcs funcs =
   pex_djgpp_wait,
   NULL, /* pipe */
   NULL, /* fdopenr */
+  NULL, /* fdopenw */
   NULL  /* cleanup */
 };
 
@@ -110,8 +112,10 @@ pex_djgpp_close (struct pex_obj *obj ATTRIBUTE_UNUSED, int fd)
 
 static long
 pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
-                     char * const * argv, int in, int out, int errdes,
-                     const char **errmsg, int *err)
+                     char * const * argv, char * const * env,
+                      int in, int out, int errdes,
+                     int toclose ATTRIBUTE_UNUSED, const char **errmsg,
+                     int *err)
 {
   int org_in, org_out, org_errdes;
   int status;
@@ -195,8 +199,12 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
        }
     }
 
-  status = (((flags & PEX_SEARCH) != 0 ? spawnvp : spawnv)
-           (P_WAIT, executable, (char * const *) argv));
+  if (env)
+    status = (((flags & PEX_SEARCH) != 0 ? spawnvpe : spawnve)
+             (P_WAIT, executable, argv, env));
+  else
+    status = (((flags & PEX_SEARCH) != 0 ? spawnvp : spawnv)
+             (P_WAIT, executable, argv));
 
   if (status == -1)
     {
@@ -257,7 +265,7 @@ pex_djgpp_exec_child (struct pex_obj *obj, int flags, const char *executable,
      is the number of children which have executed before this
      one.  */
   statuses = (int *) obj->sysdep;
-  statuses = xrealloc (statuses, (obj->count + 1) * sizeof (int));
+  statuses = XRESIZEVEC (int, statuses, obj->count + 1);
   statuses[obj->count] = status;
   obj->sysdep = (void *) statuses;