Re: Patch pg_is_in_backup()
Gurjeet Singh <singh.gurjeet@gmail.com>
From: Gurjeet Singh <singh.gurjeet@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Gabriele Bartolini <gabriele.bartolini@2ndquadrant.it>, Marco Nenciarini <marco.nenciarini@2ndquadrant.it>, Gilles Darold <gilles.darold@dalibo.com>, pgsql-hackers@postgresql.org
Date: 2012-06-14T17:48:00Z
Lists: pgsql-hackers
On Thu, Jun 14, 2012 at 1:29 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Thu, Jun 14, 2012 at 6:06 AM, Gabriele Bartolini
> <gabriele.bartolini@2ndquadrant.it> wrote:
> > thank you very much for your patience (and thank you Marco for
> supporting
> > me). I apologise for the delay.
> >
> > I have retested the updated patch and it works fine with me. It is
> "ready
> > for committer" for me.
>
> Committed.
A minor gripe:
+ /*
+ * Close the backup label file.
+ */
+ if (ferror(lfp) || FreeFile(lfp)) {
+ ereport(ERROR,
+ (errcode_for_file_access(),
+ errmsg("could not read file \"%s\": %m",
+ BACKUP_LABEL_FILE)));
+ }
+
If ferror(lfp) returns false, wouldn't we miss the FreeFile() and leak a
file pointer?
Regards,
--
Gurjeet Singh
EnterpriseDB Corporation
The Enterprise PostgreSQL Company