From a76e98f0211f5f3fac5d716ac23b7e5fb9a00129 Mon Sep 17 00:00:00 2001 From: Michael Meskes Date: Fri, 14 Nov 2008 16:25:34 +0000 Subject: [PATCH] Fixed test for output_filename == stdout. --- src/interfaces/ecpg/preproc/ecpg.header | 5 +++-- src/interfaces/ecpg/preproc/preproc.y | 11 +++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header index 6e47fa04f9..a626e4cd42 100644 --- a/src/interfaces/ecpg/preproc/ecpg.header +++ b/src/interfaces/ecpg/preproc/ecpg.header @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.1 2008/11/14 10:03:33 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.2 2008/11/14 16:25:34 meskes Exp $ */ /* Copyright comment */ %{ @@ -94,7 +94,8 @@ mmerror(int error_code, enum errortype type, char * error, ...) fclose(yyin); if (yyout) fclose(yyout); - if (unlink(output_filename) != 0 && *output_filename != '-') + + if (strcmp(output_filename, "-") != 0 && unlink(output_filename) != 0) fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename); exit(error_code); } diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index a24b921488..b76b8d3f3c 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -1,5 +1,5 @@ /* header */ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.383 2008/11/13 11:54:39 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.384 2008/11/14 16:25:34 meskes Exp $ */ /* Copyright comment */ %{ @@ -95,7 +95,8 @@ mmerror(int error_code, enum errortype type, char * error, ...) fclose(yyin); if (yyout) fclose(yyout); - if (unlink(output_filename) != 0 && *output_filename != '-') + + if (strcmp(output_filename, "-") != 0 && unlink(output_filename) != 0) fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename); exit(error_code); } @@ -390,7 +391,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu struct prep prep; } /* tokens */ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.383 2008/11/13 11:54:39 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.384 2008/11/14 16:25:34 meskes Exp $ */ /* special embedded SQL token */ %token SQL_ALLOCATE SQL_AUTOCOMMIT SQL_BOOL SQL_BREAK SQL_CALL SQL_CARDINALITY SQL_CONNECT @@ -847,7 +848,7 @@ add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enu %type reserved_keyword %type SpecialRuleRelation /* ecpgtype */ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.383 2008/11/13 11:54:39 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.384 2008/11/14 16:25:34 meskes Exp $ */ %type ECPGAllocateDescr %type ECPGCKeywords %type ECPGColId @@ -9343,6 +9344,8 @@ mmerror(PARSE_ERROR, ET_WARNING, "unsupported feature will be passed to backend\ /* trailer */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.384 2008/11/14 16:25:34 meskes Exp $ */ + statements: /*EMPTY*/ | statements statement ; -- 2.40.0