diff options
author | Meador Inge <meadori@codesourcery.com> | 2012-09-27 16:05:38 +0000 |
---|---|---|
committer | Meador Inge <meadori@gcc.gnu.org> | 2012-09-27 16:05:38 +0000 |
commit | 33adc2a3251455613837491b32de4fa5477da62a (patch) | |
tree | e19f9c9e34ec3f09dc156d55138b1e5473c2c842 /gcc/gcc-ar.c | |
parent | 207f3d820a327758415cbb7f6bc43792403497db (diff) | |
download | gcc-33adc2a3251455613837491b32de4fa5477da62a.zip gcc-33adc2a3251455613837491b32de4fa5477da62a.tar.gz gcc-33adc2a3251455613837491b32de4fa5477da62a.tar.bz2 |
gcc-ar.c (main): Handle the returning of the sub-process error code correctly.
2012-09-27 Meador Inge <meadori@codesourcery.com>
* gcc-ar.c (main): Handle the returning of the sub-process error
code correctly.
From-SVN: r191809
Diffstat (limited to 'gcc/gcc-ar.c')
-rw-r--r-- | gcc/gcc-ar.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c index caae167..5f78378 100644 --- a/gcc/gcc-ar.c +++ b/gcc/gcc-ar.c @@ -42,6 +42,7 @@ main(int ac, char **av) const char *err_msg; const char **nargv; bool is_ar = !strcmp (PERSONALITY, "ar"); + int exit_code = FATAL_EXIT_CODE; exe_name = PERSONALITY; #ifdef CROSS_DIRECTORY_STRUCTURE @@ -96,6 +97,20 @@ main(int ac, char **av) NULL,NULL, &status, &err); if (err_msg) fprintf(stderr, "Error running %s: %s\n", exe_name, err_msg); + else if (status) + { + if (WIFSIGNALED (status)) + { + int sig = WTERMSIG (status); + fprintf (stderr, "%s terminated with signal %d [%s]%s\n", + exe_name, sig, strsignal(sig), + WCOREDUMP(status) ? ", core dumped" : ""); + } + else if (WIFEXITED (status)) + exit_code = WEXITSTATUS (status); + } + else + exit_code = SUCCESS_EXIT_CODE; - return err; + return exit_code; } |