From 2d6840917d290e343c5acfb908c765ea0559c757 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Wed, 28 Nov 2007 19:39:40 +0000 Subject: [PATCH] Don't try to delete the output file if we don't know its name yet. --- gold/gold.cc | 2 +- gold/parameters.h | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/gold/gold.cc b/gold/gold.cc index 9baebaf6022..0b7c2ecfee3 100644 --- a/gold/gold.cc +++ b/gold/gold.cc @@ -47,7 +47,7 @@ const char* program_name; void gold_exit(bool status) { - if (!status && parameters != NULL) + if (!status && parameters != NULL && parameters->options_valid()) unlink_if_ordinary(parameters->output_file_name()); exit(status ? EXIT_SUCCESS : EXIT_FAILURE); } diff --git a/gold/parameters.h b/gold/parameters.h index 4e135c61e27..4b764e32149 100644 --- a/gold/parameters.h +++ b/gold/parameters.h @@ -47,6 +47,12 @@ class Parameters errors() const { return this->errors_; } + // Whether the options are valid. This should not normally be + // called, but it is needed by gold_exit. + bool + options_valid() const + { return this->options_valid_; } + // Whether to use threads. bool threads() const -- 2.30.2