winebuild: Don't register cleanup function when --save-temps is passed after --output.

Tijl Coosemans tijl at coosemans.org
Mon Mar 4 10:21:16 CST 2013


---
 tools/winebuild/build.h | 2 +-
 tools/winebuild/main.c  | 4 +++-
 tools/winebuild/utils.c | 4 +---
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 3fbf89d..359428f 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -250,6 +250,7 @@ extern char *find_tool( const char *name, const char * const *names );
 extern struct strarray *get_as_command(void);
 extern struct strarray *get_ld_command(void);
 extern const char *get_nm_command(void);
+extern void cleanup_tmp_files(void);
 extern char *get_temp_file_name( const char *prefix, const char *suffix );
 extern void output_standard_file_header(void);
 extern FILE *open_input_file( const char *srcdir, const char *name );
@@ -347,7 +348,6 @@ extern int nb_errors;
 extern int display_warnings;
 extern int kill_at;
 extern int verbose;
-extern int save_temps;
 extern int link_ext_symbols;
 extern int force_pointer_size;
 extern int unwind_tables;
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index 094eaa5..469c9ef 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -44,7 +44,6 @@ int nb_errors = 0;
 int display_warnings = 0;
 int kill_at = 0;
 int verbose = 0;
-int save_temps = 0;
 int link_ext_symbols = 0;
 int force_pointer_size = 0;
 int unwind_tables = 0;
@@ -359,6 +358,7 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
 {
     char *p;
     int optc;
+    int save_temps = 0;
 
     while ((optc = getopt_long( argc, argv, short_options, long_options, NULL )) != -1)
     {
@@ -516,6 +516,8 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
         }
     }
 
+    if (!save_temps) atexit( cleanup_tmp_files );
+
     if (spec->file_name && !strchr( spec->file_name, '.' ))
         strcat( spec->file_name, exec_mode == MODE_EXE ? ".exe" : ".dll" );
     init_dll_name( spec );
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index 262ff3a..bab2b85 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -64,7 +64,7 @@ static const struct
 };
 
 /* atexit handler to clean tmp files */
-static void cleanup_tmp_files(void)
+void cleanup_tmp_files(void)
 {
     unsigned int i;
     for (i = 0; i < nb_tmp_files; i++) if (tmp_files[i]) unlink( tmp_files[i] );
@@ -461,8 +461,6 @@ char *get_temp_file_name( const char *prefix, const char *suffix )
     const char *ext, *basename;
     int fd;
 
-    if (!nb_tmp_files && !save_temps) atexit( cleanup_tmp_files );
-
     if (!prefix || !prefix[0]) prefix = "winebuild";
     if (!suffix) suffix = "";
     if ((basename = strrchr( prefix, '/' ))) basename++;
-- 
1.8.1.3




More information about the wine-patches mailing list