diff --git a/tools/widl/utils.c b/tools/widl/utils.c index feb590057f5..aad40f6b087 100644 --- a/tools/widl/utils.c +++ b/tools/widl/utils.c @@ -276,7 +276,6 @@ void add_output_to_resources( const char *type, const char *name ) void flush_output_resources( const char *name ) { - int fd; unsigned int i; /* all output must have been saved with add_output_to_resources() first */ @@ -294,19 +293,13 @@ void flush_output_resources( const char *name ) put_dword( 0 ); /* Version */ put_dword( 0 ); /* Characteristics */ - fd = open( name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666 ); - if (fd == -1) error( "Error creating %s\n", name ); - if (write( fd, output_buffer, output_buffer_pos ) != output_buffer_pos) - error( "Error writing to %s\n", name ); for (i = 0; i < nb_resources; i++) { - if (write( fd, resources[i].data, resources[i].size ) != resources[i].size) - error( "Error writing to %s\n", name ); + put_data( resources[i].data, resources[i].size ); free( resources[i].data ); } - close( fd ); + flush_output_buffer( name ); nb_resources = 0; - free( output_buffer ); } /* pointer-sized word */ diff --git a/tools/winebuild/res32.c b/tools/winebuild/res32.c index 85c49d0019a..a0209ad6f2a 100644 --- a/tools/winebuild/res32.c +++ b/tools/winebuild/res32.c @@ -623,7 +623,6 @@ void output_res_o_file( DLLSPEC *spec ) { unsigned int i; char *res_file = NULL; - int fd; struct strarray args; if (!spec->nb_resources) fatal_error( "--resources mode needs at least one resource file as input\n" ); @@ -673,12 +672,7 @@ void output_res_o_file( DLLSPEC *spec ) } res_file = get_temp_file_name( output_file_name, ".res" ); - if ((fd = open( res_file, O_WRONLY|O_CREAT|O_TRUNC|O_BINARY, 0600 )) == -1) - fatal_error( "Cannot create %s\n", res_file ); - if (write( fd, output_buffer, output_buffer_pos ) != output_buffer_pos) - fatal_error( "Error writing to %s\n", res_file ); - close( fd ); - free( output_buffer ); + flush_output_buffer( res_file ); args = find_tool( "windres", NULL ); strarray_add( &args, "-i" );