Commit b253bd65 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winegcc: Clean up output file on error.

Based on winebuild. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent b0ea67ed
...@@ -139,6 +139,7 @@ static const char* app_loader_template = ...@@ -139,6 +139,7 @@ static const char* app_loader_template =
"exec \"$WINELOADER\" \"$apppath\" \"$@\"\n" "exec \"$WINELOADER\" \"$apppath\" \"$@\"\n"
; ;
static const char *output_file_name;
static int keep_generated = 0; static int keep_generated = 0;
static strarray* tmp_files; static strarray* tmp_files;
#ifdef HAVE_SIGSET_T #ifdef HAVE_SIGSET_T
...@@ -262,6 +263,11 @@ static enum target_platform build_platform = PLATFORM_WINDOWS; ...@@ -262,6 +263,11 @@ static enum target_platform build_platform = PLATFORM_WINDOWS;
static enum target_platform build_platform = PLATFORM_UNSPECIFIED; static enum target_platform build_platform = PLATFORM_UNSPECIFIED;
#endif #endif
static void cleanup_output_files(void)
{
if (output_file_name) unlink( output_file_name );
}
static void clean_temp_files(void) static void clean_temp_files(void)
{ {
unsigned int i; unsigned int i;
...@@ -1305,6 +1311,9 @@ static void build(struct options* opts) ...@@ -1305,6 +1311,9 @@ static void build(struct options* opts)
if (libgcc) strarray_add(link_args, libgcc); if (libgcc) strarray_add(link_args, libgcc);
output_file_name = output_path;
atexit( cleanup_output_files );
spawn(opts->prefix, link_args, 0); spawn(opts->prefix, link_args, 0);
strarray_free (link_args); strarray_free (link_args);
...@@ -1836,5 +1845,6 @@ int main(int argc, char **argv) ...@@ -1836,5 +1845,6 @@ int main(int argc, char **argv)
else if (linking) build(&opts); else if (linking) build(&opts);
else compile(&opts, lang); else compile(&opts, lang);
output_file_name = NULL;
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment