Thread: pgsql: Added files containing changes between gram.y and preproc.y.

Re: pgsql: Added files containing changes between gram.y and preproc.y.

From
Alvaro Herrera
Date:
Michael Meskes wrote:

>         ecpg.header (r1.1)
>
(http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/ecpg/preproc/ecpg.header?rev=1.1&content-type=text/x-cvsweb-markup)

I stumbled upon this

+               case ET_FATAL:
+                       if (yyin)
+                               fclose(yyin);
+                       if (yyout)
+                               fclose(yyout);
+                       if (unlink(output_filename) != 0 && *output_filename != '-')
+                               fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename);

and wondered if this works when you have an output file named
"-foobar.c" or something like that ...

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: pgsql: Added files containing changes between gram.y and preproc.y.

From
Michael Meskes
Date:
On Fri, Nov 14, 2008 at 09:16:20AM -0300, Alvaro Herrera wrote:
> I stumbled upon this
>
> +               case ET_FATAL:
> +                       if (yyin)
> +                               fclose(yyin);
> +                       if (yyout)
> +                               fclose(yyout);
> +                       if (unlink(output_filename) != 0 && *output_filename != '-')
> +                               fprintf(stderr, _("could not remove output file \"%s\"\n"), output_filename);
>
> and wondered if this works when you have an output file named
> "-foobar.c" or something like that ...

If this file is not deletable this will probably not work, I agree. This code
is pretty old and apparently no one ever tried but still also checking for
output_filename[1] beng blank or '\0' seems to make sense.

Michael
--
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!