diff options
author | Jeff Law <law@redhat.com> | 2000-07-27 01:49:21 +0000 |
---|---|---|
committer | Jeff Law <law@redhat.com> | 2000-07-27 01:49:21 +0000 |
commit | ddf49f6ed4c8073c5368e1850b560a8a5b32dc7e (patch) | |
tree | 9a24c51979b073f330a3f720998aceeb3bfa2146 | |
parent | b2fe545704f0331ebb24692fc98f4d5f8ed8df26 (diff) | |
download | gdb-ddf49f6ed4c8073c5368e1850b560a8a5b32dc7e.tar.gz |
* pexecute.c (pexecute) [__MSDOS__]: Change __GO32__ to
__DJGPP__. Use P_WAIT instead of constant in the spawnv* call.
Cast program to 'char *' in errmsg_arg assignment.
(PWAIT_ERROR): Define.
(pwait): Use PWAIT_ERROR. Adjust DJGPP's status code to conform
to DJGPP's WIF* macros.
-rw-r--r-- | libiberty/ChangeLog | 9 | ||||
-rw-r--r-- | libiberty/pexecute.c | 20 |
2 files changed, 24 insertions, 5 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 9acd322846c..d8cada80147 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,12 @@ +2000-07-26 Mark Elbrecht <snowball3@bigfoot.com> + + * pexecute.c (pexecute) [__MSDOS__]: Change __GO32__ to + __DJGPP__. Use P_WAIT instead of constant in the spawnv* call. + Cast program to 'char *' in errmsg_arg assignment. + (PWAIT_ERROR): Define. + (pwait): Use PWAIT_ERROR. Adjust DJGPP's status code to conform + to DJGPP's WIF* macros. + 2000-07-27 RodneyBrown <RodneyBrown@pmsc.com> Jeff Law <law@cygnus.com> diff --git a/libiberty/pexecute.c b/libiberty/pexecute.c index 4a1970d5309..9c62b57bbdb 100644 --- a/libiberty/pexecute.c +++ b/libiberty/pexecute.c @@ -157,9 +157,9 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) if ((flags & PEXECUTE_ONE) != PEXECUTE_ONE) abort (); -#ifdef __GO32__ +#ifdef __DJGPP__ /* ??? What are the possible return values from spawnv? */ - rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (1, program, argv); + rc = (flags & PEXECUTE_SEARCH ? spawnvp : spawnv) (P_WAIT, program, argv); #else char *scmd, *rf; FILE *argfile; @@ -208,7 +208,7 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) if (rc == -1) { *errmsg_fmt = install_error_msg; - *errmsg_arg = program; + *errmsg_arg = (char *)program; return -1; } @@ -217,6 +217,13 @@ pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags) return last_pid; } +/* Use ECHILD if available, otherwise use EINVAL. */ +#ifdef ECHILD +#define PWAIT_ERROR ECHILD +#else +#define PWAIT_ERROR EINVAL +#endif + int pwait (pid, status, flags) int pid; @@ -228,13 +235,16 @@ pwait (pid, status, flags) /* Called twice for the same child? */ || pid == last_reaped) { - /* ??? ECHILD would be a better choice. Can we use it here? */ - errno = EINVAL; + errno = PWAIT_ERROR; return -1; } /* ??? Here's an opportunity to canonicalize the values in STATUS. Needed? */ +#ifdef __DJGPP__ + *status = (last_status >> 8); +#else *status = last_status; +#endif last_reaped = last_pid; return last_pid; } |