Re: PATCH: pg_basebackup (missing exit on error)

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: PATCH: pg_basebackup (missing exit on error)
Дата
Msg-id CA+TgmoZTVdHQVS3HksoOVmAY44C49mxv+K166vWgZrJ0Gavyjg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PATCH: pg_basebackup (missing exit on error)  (Fujii Masao <masao.fujii@gmail.com>)
Ответы Re: PATCH: pg_basebackup (missing exit on error)
Список pgsql-hackers
On Tue, Mar 27, 2012 at 7:13 AM, Fujii Masao <masao.fujii@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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Shigeru HANADA
Дата:
Сообщение: Re: pgsql_fdw, FDW for PostgreSQL server
Следующее
От: Robert Haas
Дата:
Сообщение: Re: Improvement of log messages in pg_basebackup