Skip to content
Snippets Groups Projects
Commit 5f5ba923 authored by Michael Meskes's avatar Michael Meskes
Browse files

Make ecpg in line with other compilers in that it deletes its output if there...

Make ecpg in line with other compilers in that it deletes its output if there was an error processing the input file.

Work done by Zoltan.
parent a404a12f
No related branches found
No related tags found
No related merge requests found
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.114 2010/02/26 02:01:31 momjian Exp $ */ /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.115 2010/04/03 19:30:49 meskes Exp $ */
/* Main for ecpg, the PostgreSQL embedded SQL precompiler. */ /* Main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* Copyright (c) 1996-2010, PostgreSQL Global Development Group */ /* Copyright (c) 1996-2010, PostgreSQL Global Development Group */
...@@ -469,6 +469,14 @@ main(int argc, char *const argv[]) ...@@ -469,6 +469,14 @@ main(int argc, char *const argv[])
fclose(yyin); fclose(yyin);
if (out_option == 0 && yyout != stdout) if (out_option == 0 && yyout != stdout)
fclose(yyout); fclose(yyout);
/*
* If there was an error, delete the output file.
*/
if (ret_value != 0)
{
if (strcmp(output_filename, "-") != 0 && unlink(output_filename) != 0)
fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename);
}
} }
if (output_filename && out_option == 0) if (output_filename && out_option == 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment