Re: [PATCH] Fix fd leak in pg_dump compression backends when dup()+fdopen() fails - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] Fix fd leak in pg_dump compression backends when dup()+fdopen() fails
Date
Msg-id 1305470.1773941734@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH] Fix fd leak in pg_dump compression backends when dup()+fdopen() fails  (Jianghua Yang <yjhjstz@gmail.com>)
Responses Re: [PATCH] Fix fd leak in pg_dump compression backends when dup()+fdopen() fails
List pgsql-hackers
Jianghua Yang <yjhjstz@gmail.com> writes:
>   That said, the patch does fix a real diagnostic problem.  In the
>   original code, when dup() fails with EMFILE, the -1 return value is
>   passed directly to fdopen(), which fails with EBADF.  The user sees:
>     pg_dump: error: could not open output file: Bad file descriptor
>   which is misleading -- the actual cause is fd exhaustion, not a bad
>   descriptor.  With the patch, errno is preserved correctly, so the
>   message becomes:
>     pg_dump: error: could not open output file: Too many open files
>   which gives the user actionable information.

Fair point.  Still, this is such an unlikely edge-case that
I don't think it's worth a back-patch.  Let's just do HEAD.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: generic plans and "initial" pruning
Next
From: "Greg Burd"
Date:
Subject: Re: another autovacuum scheduling thread