Try to unlink output file before opening it.

This commit is contained in:
Peter Ganten 2000-07-15 15:13:09 +00:00 committed by Alexandre Julliard
parent 235d39cf9e
commit 13a07b999f
1 changed files with 6 additions and 0 deletions

View File

@ -11,6 +11,7 @@
#include <assert.h> #include <assert.h>
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h>
#include "winnt.h" #include "winnt.h"
#include "build.h" #include "build.h"
@ -113,6 +114,11 @@ static void do_pic(void)
static void do_output( const char *arg ) static void do_output( const char *arg )
{ {
if ( ( unlink ( arg ) ) == -1 && ( errno != ENOENT ) )
{
fprintf ( stderr, "Unable to create output file '%s'\n", arg );
exit (1);
}
if (!(output_file = fopen( arg, "w" ))) if (!(output_file = fopen( arg, "w" )))
{ {
fprintf( stderr, "Unable to create output file '%s'\n", arg ); fprintf( stderr, "Unable to create output file '%s'\n", arg );