+2009-04-13 Ozkan Sezer <sezeroz@gmail.com>
+
+ PR target/39397
+ * pex-common.h (struct pex_obj): Store pid values as pid_t,
+ not as long (members *children and (*wait))
+ * pex-common.c (pex_run_in_environment): Likewise.
+ * pex-win32.c (pex_win32_wait): Return pid_t and properly check
+ returned pid value.
+ * pex-djgpp.c (pex_djgpp_wait): Return pid_t.
+ * pex-msdos.c (pex_msdos_wait): Likewise.
+
2009-04-07 Arnaud Patard <apatard@mandriva.com>
* libiberty/configure.ac: Fix Linux/MIPS matching rule.
int outname_allocated;
int p[2];
int toclose;
- long pid;
+ pid_t pid;
in = -1;
out = -1;
goto error_exit;
++obj->count;
- obj->children = XRESIZEVEC (long, obj->children, obj->count);
+ obj->children = XRESIZEVEC (pid_t, obj->children, obj->count);
obj->children[obj->count - 1] = pid;
return NULL;
/* Number of child processes. */
int count;
/* PIDs of child processes; array allocated using malloc. */
- long *children;
+ pid_t *children;
/* Exit statuses of child processes; array allocated using malloc. */
int *status;
/* Time used by child processes; array allocated using malloc. */
and time in *TIME (if it is not null). CHILD is from fork. DONE
is 1 if this is called via pex_free. ERRMSG and ERR are as in
fork. Return 0 on success, -1 on error. */
- int (*wait) (struct pex_obj *, pid_t /* child */, int * /* status */,
+ pid_t (*wait) (struct pex_obj *, pid_t /* child */, int * /* status */,
struct pex_time * /* time */, int /* done */,
const char ** /* errmsg */, int * /* err */);
/* Create a pipe (only called if PEX_USE_PIPES is set) storing two
int, int, int, int,
const char **, int *);
static int pex_djgpp_close (struct pex_obj *, int);
-static int pex_djgpp_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
+static pid_t pex_djgpp_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
int, const char **, int *);
/* The list of functions we pass to the common routines. */
has already completed, and we just need to return the exit
status. */
-static int
+static pid_t
pex_djgpp_wait (struct pex_obj *obj, pid_t pid, int *status,
struct pex_time *time, int done ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED,
int, int, int, int,
int, const char **, int *);
static int pex_msdos_close (struct pex_obj *, int);
-static int pex_msdos_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
+static pid_t pex_msdos_wait (struct pex_obj *, pid_t, int *, struct pex_time *,
int, const char **, int *);
static void pex_msdos_cleanup (struct pex_obj *);
has already completed, and we just need to return the exit
status. */
-static int
+static pid_t
pex_msdos_wait (struct pex_obj *obj, pid_t pid, int *status,
struct pex_time *time, int done ATTRIBUTE_UNUSED,
const char **errmsg ATTRIBUTE_UNUSED,
int, int, int, int,
const char **, int *);
static int pex_win32_close (struct pex_obj *, int);
-static int pex_win32_wait (struct pex_obj *, pid_t, int *,
+static pid_t pex_win32_wait (struct pex_obj *, pid_t, int *,
struct pex_time *, int, const char **, int *);
static int pex_win32_pipe (struct pex_obj *, int *, int);
static FILE *pex_win32_fdopenr (struct pex_obj *, int, int);
dwCreationFlags, si, pi);
if (executable1 != newex)
free ((char *) newex);
- if ((long) pid < 0)
+ if (pid == (pid_t) -1)
{
newex = msys_rootify (executable1);
if (newex != executable1)
}
}
}
- if ((long) pid < 0)
+ if (pid == (pid_t) -1)
errno = save_errno;
return pid;
}
status == 3. We fix the status code to conform to the usual WIF*
macros. Note that WIFSIGNALED will never be true under CRTDLL. */
-static int
+static pid_t
pex_win32_wait (struct pex_obj *obj ATTRIBUTE_UNUSED, pid_t pid,
int *status, struct pex_time *time, int done ATTRIBUTE_UNUSED,
const char **errmsg, int *err)