Re: pgsql: Fix inconsequential FILE pointer leakage

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-committers <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql: Fix inconsequential FILE pointer leakage
Date: 2010-12-16 20:16:58
Message-ID: 1292530585-sup-7453@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Excerpts from Tom Lane's message of jue dic 16 17:00:43 -0300 2010:

> --- a/src/port/exec.c
> +++ b/src/port/exec.c
> @@ -357,6 +357,7 @@ pipe_read_line(char *cmd, char *line, int maxsize)
>
> if (fgets(line, maxsize, pgver) == NULL)
> {
> + pclose(pgver); /* no error checking */
> perror("fgets failure");
> return NULL;
> }
>
> Doesn't this risk having pclose trash the errno setting that perror is
> going to print? If you must do this, please do it in the other order.

Gah, yes, sorry. Fixed.

--
Álvaro Herrera <alvherre(at)commandprompt(dot)com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2010-12-16 21:23:25 pgsql: Remove optreset from src/port/ implementations of getopt and get
Previous Message Alvaro Herrera 2010-12-16 20:16:30 pgsql: Avoid clobbering errno, per comment from Tom.