--On 9. Februar 2014 13:55:03 -0500 Tom Lane <[email protected]> wrote:
Agreed; we should be using the same coding pattern wherever we call
ftello.
I suspect that this code may be left over from coping with some ancient
non-spec-compliant version of ftello? Probably not worth digging in
the archives to find out. The Single Unix Spec v2 says that the result
is (off_t) -1 on error, and we generally assume that platforms are at
least compliant with that.
grep shows me a couple of other places where the result of ftello doesn't
seem to be getting checked for error. Odd that Coverity didn't notice
those.
It stroke me today that there's still something broken. pg_dump fails when
used in custom archive mode and piping to e.g. pg_restore:
pg_dump -Fc -p 5447 regression | pg_restore
pg_dump: [custom archiver] could not determine seek position in archive
file: Illegal seek
pg_restore: [custom archiver] unexpected end of file
pg_dump fails in _CloseArchive() with this hunk:
+ if (tpos < 0 || errno)
+ exit_horribly(modulename, "could not determine seek position in archive
file: %s\n",
+ strerror(errno));
errno is set to 29, which is ESPIPE and tpos was set to -1. If I read the
manpage on OSX here correctly, ftell[o] will always fail if used with a
pipe in this case:
[ESPIPE] The file descriptor underlying stream is associated
with a pipe or FIFO or file-position indicator
value is unspecified (see ungetc(3)).
A quick check shows that Debian has the same issue.
--
Thanks
Bernd
--
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers