From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Justin Pryzby <pryzby@telsasoft.com>
Cc: pgsql-hackers@postgresql.org, Kunshchikov Vladimir <Vladimir.Kunshchikov@infotecs.ru>
Subject: Re: pg_dump, gzwrite, and errno
Date: Thu, 18 Jun 2020 17:20:27 -0400
Message-ID: <20200618212027.GA17103@alvherre.pgsql> (raw)
In-Reply-To: <20200611153753.GU14879@telsasoft.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@2ndquadrant.com, pryzby@telsasoft.com, Vladimir.Kunshchikov@infotecs.ru
Subject: Re: pg_dump, gzwrite, and errno
In-Reply-To: <20200618212027.GA17103@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox