diff options
author | Rafael Avila de Espindola <espindola@google.com> | 2009-11-24 15:00:15 +0000 |
---|---|---|
committer | Rafael Espindola <espindola@gcc.gnu.org> | 2009-11-24 15:00:15 +0000 |
commit | 8aea79e6c91d187cc64058e615d0c8347dd79b63 (patch) | |
tree | 5883b35114ee1f36785b234871a9a477dcaeac44 /gcc/lto-wrapper.c | |
parent | 338877519ddf8530a92672bb457929bf57b6d2dd (diff) | |
download | gcc-8aea79e6c91d187cc64058e615d0c8347dd79b63.tar.gz |
lto-wrapper.c (lto_wrapper_exit): Don't try to delete files if being called recursively.
2009-11-24 Rafael Avila de Espindola <espindola@google.com>
* lto-wrapper.c (lto_wrapper_exit): Don't try to delete files if
being called recursively.
From-SVN: r154500
Diffstat (limited to 'gcc/lto-wrapper.c')
-rw-r--r-- | gcc/lto-wrapper.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index cddd4156a35..5f24f59564d 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -66,12 +66,20 @@ static void maybe_unlink_file (const char *); static void lto_wrapper_exit (int status) { - if (ltrans_output_file) - maybe_unlink_file (ltrans_output_file); - if (flto_out) - maybe_unlink_file (flto_out); - if (args_name) - maybe_unlink_file (args_name); + static bool cleanup_done = false; + if (!cleanup_done) + { + /* Setting cleanup_done prevents an infinite loop if one of the + calls to maybe_unlink_file fails. */ + cleanup_done = true; + + if (ltrans_output_file) + maybe_unlink_file (ltrans_output_file); + if (flto_out) + maybe_unlink_file (flto_out); + if (args_name) + maybe_unlink_file (args_name); + } exit (status); } |