Should not try to unlink stdout.
authorMichael Meskes <meskes@postgresql.org>
Mon, 11 Jun 2007 12:01:23 +0000 (12:01 +0000)
committerMichael Meskes <meskes@postgresql.org>
Mon, 11 Jun 2007 12:01:23 +0000 (12:01 +0000)
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/preproc/preproc.y

index aacd2e26d0dffab7734e5e62c2bdfc018cfd34de..28aaca24e672ebf3b5e47c85d6defe2cd3e28fe5 100644 (file)
@@ -2203,4 +2203,9 @@ Sun, 27 May 2007 13:14:39 +0200
 
        - Changed variable test to not run into infinite loops on backend
          errors.
+
+Mon, 11 Jun 2007 13:59:57 +0200
+
+       - Fixed memory leak in descriptor code.
+       - Made ecpg delete output file in case of an error.
        - Set ecpg version to 4.3.1.
index 45a8359f1a70fb9d8a5be7c93348a581536b912f..b494a409e042b8f558cee2049c02e0ca5a1356e5 100644 (file)
@@ -5,6 +5,7 @@
 #include "postgres_fe.h"
 
 #include "extern.h"
+#include <unistd.h>
 
 /* Location tracking support --- simpler than bison's default */
 #define YYLLOC_DEFAULT(Current, Rhs, N) \
@@ -101,8 +102,8 @@ mmerror(int error_code, enum errortype type, char * error, ...)
                case ET_FATAL:
                        fclose(yyin);
                        fclose(yyout);
-                       if (unlink(output_filename) != 0)
-                               fprintf(stderr, "Could not remove ourput file %s!\n", output_filename);
+                       if (unlink(output_filename) != 0 && *output_filename != '-')
+                               fprintf(stderr, "Could not remove output file %s!\n", output_filename);
                        exit(error_code);
        }
 }