pg_dump, gzwrite, and errno

2020-06-11 Thread Justin Pryzby
While testing Pavel's patch for pg_dump --filter, I got: pg_dump: error: could not write to output file: Success [pryzbyj@database postgresql]$ echo $? 1 I see we tried to fix it few years ago: https://www.postgresql.org/message-id/flat/1498120508308.9826%40infotecs.ru https://www.postgresql.org/

Re: pg_dump, gzwrite, and errno

2020-06-18 Thread Alvaro Herrera
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

Re: pg_dump, gzwrite, and errno

2020-06-18 Thread Tom Lane
Alvaro Herrera writes: > 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->forma

Re: pg_dump, gzwrite, and errno

2020-06-19 Thread Alvaro Herrera
On 2020-Jun-18, Tom Lane wrote: > Surely it's insufficient as-is, because there is no reason to suppose > that errno is zero at entry. You'd need to set errno = 0 first. Oh, right. > Also it's fairly customary in our sources to include a comment about > this machination; so the full ritual is u