Hi.

Per Coverity.
CID 1506240: (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
3. negative_returns: dup(fd) is passed to a parameter that cannot be
negative.

pg_dump function open_none, tries to associate a stream to a file
descriptor,
using function dup, which may fail and return negative value.

fdopen cannot receive negative parameters, in this case fail and return
EBADF.

This can be confusing for the user, who will be trying to figure out what's
wrong.
Better abort and report the correct failure to the user.

Patch attached.

Best regards,
Ranier Vilela

Attachment: abort-if-dup-fail-pg_dump.patch
Description: Binary data

Reply via email to