gzclose don't set properly the errno in pg_restore

From: Fabrízio de Royes Mello <fabriziomello(at)gmail(dot)com>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: gzclose don't set properly the errno in pg_restore
Date: 2016-03-07 01:09:20
Message-ID: CAFcNs+os5ExGvXMBrBBzzuJJamoHt5-zdJdxX39nkVG0KUxwsw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I'm facing with a strange error message during a failed pg_restore:

pg_restore: processing data for table "historicopesquisaitem"
pg_restore: [directory archiver] could not close data file: Success

I got this error trying to restore from a directory dump file.

Looking at the pg_restore code seems that "gzclose" didn't set the 'errno'
because I got a Z_BUF_ERROR [1] from "cfclose" return and the "errno" still
0 (zero).

412 if (cfclose(cfp) !=0)
413 exit_horribly(modulename, "could not close data file: %s\n",
414 strerror(errno));

Should we set the errno using the gzclose return code or just add some
check to "strerror" the "errno" or the "gzclose return code" if they are
different?

Thoughts?

[1] http://www.zlib.net/manual.html

--
Fabrízio de Royes Mello
Consultoria/Coaching PostgreSQL
>> Timbira: http://www.timbira.com.br
>> Blog: http://fabriziomello.github.io
>> Linkedin: http://br.linkedin.com/in/fabriziomello
>> Twitter: http://twitter.com/fabriziomello
>> Github: http://github.com/fabriziomello

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joe Conway 2016-03-07 01:16:42 Re: Badly designed error reporting code in controldata_utils.c
Previous Message Thomas Munro 2016-03-06 23:12:03 Re: Proposal: "Causal reads" mode for load balancing reads without stale data