On Tue, Mar 27, 2012 at 7:13 AM, Fujii Masao <masao.fu...@gmail.com> wrote:
> Attached patch removes the fflush() part, changes the log message and removes
> the check of tarfile, as above.

With this patch applied, we end up with:

            if (strcmp(basedir, "-") == 0)
            {
#ifdef HAVE_LIBZ
                if (ztarfile != NULL)
                    gzclose(ztarfile);
#endif
            }
            else
            {
#ifdef HAVE_LIBZ
                if (ztarfile != NULL)
                    gzclose(ztarfile);
                else
#endif
                {
                    if (fclose(tarfile) != 0)
                    {
                        fprintf(stderr, _("%s: could not close file
\"%s\": %s\n"),
                                progname, filename, strerror (errno));
                        disconnect_and_exit(1);
                    }
                }
            }

I think it would make sense to rearrange that so that we don't have
two tests for ztarfile != NULL; do that test first, and then if it
fails, do the strcmp after that.

Also, if we're going to test the return value of fclose(), shouldn't
we also be checking the return value of gzclose()?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to