Re: pg_dump, gzwrite, and errno

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: pg_dump, gzwrite, and errno
Дата
Msg-id 20200618212027.GA17103@alvherre.pgsql
обсуждение исходный текст
Ответ на pg_dump, gzwrite, and errno  (Justin Pryzby <pryzby@telsasoft.com>)
Ответы Re: pg_dump, gzwrite, and errno  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2020-Jun-11, Justin Pryzby wrote:

> --- a/src/bin/pg_dump/pg_backup_directory.c
> +++ b/src/bin/pg_dump/pg_backup_directory.c
> @@ -347,8 +347,12 @@ _WriteData(ArchiveHandle *AH, const void *data, size_t dLen)
>         lclContext *ctx = (lclContext *) AH->formatData;
>  
>         if (dLen > 0 && cfwrite(data, dLen, ctx->dataFH) != dLen)
> +       {
> +               if (errno == 0)
> +                       errno = ENOSPC;
>                 fatal("could not write to output file: %s",
>                           get_cfp_error(ctx->dataFH));
> +       }
>  }

This seems correct to me.  (I spent a long time looking at zlib sources
to convince myself that it does work with compressed files too).  There
are more calls to cfwrite in pg_backup_directory.c though -- we should
patch them all.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: jsonpath versus NaN
Следующее
От: "Bossart, Nathan"
Дата:
Сообщение: Re: Add support for INDEX_CLEANUP and TRUNCATE to vacuumdb