Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2006-06-08 10:55:17 +0400
committerNathan Sidwell <nathan@codesourcery.com>2006-06-08 10:55:17 +0400
commitbff849823551b6bafd5814540f74bddc2d3b5819 (patch)
treec0a084df4f1305069373c5861388f190f70981ad
parent6e5097641b55e6558dd1366d539225431dc156dc (diff)
* libgloss/m68k/bdm-system.c (_system): Properly encode nonnewlib-csl-sourcerygxx-4_1-7
failure exit code.
-rw-r--r--ChangeLog.csl5
-rw-r--r--libgloss/m68k/bdm-system.c18
2 files changed, 21 insertions, 2 deletions
diff --git a/ChangeLog.csl b/ChangeLog.csl
index 8bea8328f..5e038bd00 100644
--- a/ChangeLog.csl
+++ b/ChangeLog.csl
@@ -1,3 +1,8 @@
+2006-06-08 Nathan Sidwell <nathan@codesourcery.com>
+
+ * libgloss/m68k/bdm-system.c (_system): Properly encode non
+ failure exit code.
+
2006-06-05 Nathan Sidwell <nathan@codesourcery.com>
* libgloss/m68k/Makefile.in (BDM_SYSOBJS): Remove bdm-inbyte.o.
diff --git a/libgloss/m68k/bdm-system.c b/libgloss/m68k/bdm-system.c
index 3514f2620..433713072 100644
--- a/libgloss/m68k/bdm-system.c
+++ b/libgloss/m68k/bdm-system.c
@@ -19,7 +19,7 @@
#include <stdlib.h>
#include <string.h>
#include <errno.h>
-
+#include <sys/wait.h>
/*
* system: execute command on (remote) host
* input parameters:
@@ -32,10 +32,24 @@
int _system (const char *command)
{
+ int e;
gdb_parambuf_t parameters;
+
parameters[0] = (uint32_t) command;
parameters[1] = (uint32_t) strlen (command) + 1;
BDM_TRAP (BDM_SYSTEM, (uint32_t)parameters);
errno = convert_from_gdb_errno (parameters[1]);
- return parameters[0];
+ e = parameters[0];
+ if (e >= 0)
+ {
+ /* We have to convert e, an exit status to the encoded status of
+ the command. To avoid hard coding the exit status, we simply
+ loop until we find the right position. */
+ int exit_code;
+
+ for (exit_code = e; e && WEXITSTATUS (e) != exit_code; e <<= 1)
+ continue;
+ }
+
+ return e;
}