Jacek Caban : winegcc: Clean up output file on error.
Alexandre Julliard
julliard at winehq.org
Fri Feb 21 15:27:06 CST 2020
Module: wine
Branch: master
Commit: b253bd65658fe7dde8e50d7f7e6930cd215282df
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b253bd65658fe7dde8e50d7f7e6930cd215282df
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Feb 21 13:52:31 2020 +0100
winegcc: Clean up output file on error.
Based on winebuild.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
tools/winegcc/winegcc.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c
index d735941a53..c3eafdfc21 100644
--- a/tools/winegcc/winegcc.c
+++ b/tools/winegcc/winegcc.c
@@ -139,6 +139,7 @@ static const char* app_loader_template =
"exec \"$WINELOADER\" \"$apppath\" \"$@\"\n"
;
+static const char *output_file_name;
static int keep_generated = 0;
static strarray* tmp_files;
#ifdef HAVE_SIGSET_T
@@ -262,6 +263,11 @@ static enum target_platform build_platform = PLATFORM_WINDOWS;
static enum target_platform build_platform = PLATFORM_UNSPECIFIED;
#endif
+static void cleanup_output_files(void)
+{
+ if (output_file_name) unlink( output_file_name );
+}
+
static void clean_temp_files(void)
{
unsigned int i;
@@ -1305,6 +1311,9 @@ static void build(struct options* opts)
if (libgcc) strarray_add(link_args, libgcc);
+ output_file_name = output_path;
+ atexit( cleanup_output_files );
+
spawn(opts->prefix, link_args, 0);
strarray_free (link_args);
@@ -1836,5 +1845,6 @@ int main(int argc, char **argv)
else if (linking) build(&opts);
else compile(&opts, lang);
+ output_file_name = NULL;
return 0;
}
More information about the wine-cvs
mailing list