Re: Should libpq set close-on-exec flag on its socket?

From: dom(at)happygiraffe(dot)net (Dominic Mitchell)
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Should libpq set close-on-exec flag on its socket?
Date: 2004-10-22 11:53:03
Message-ID: 20041022115303.GA62269@ppe.happygiraffe.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 21, 2004 at 02:10:48PM -0400, Tom Lane wrote:
> It was suggested to me off-list that libpq should do
> "fcntl(fd, F_SETFD, FD_CLOEXEC)" on the socket connecting to the server.
> This would prevent any child program from accidentally or maliciously
> interfering with the connection. It would also prevent people from
> deliberately turning over a connection to a child; I'm not sure that
> that's useful, but I'm not sure it's useless either.
>
> Comments, opinions?

This is a very good idea. We've had problems with Perl programs that
call other scripts (over an exec boundary) and end up with unnecessary
DBD::Pg file handles hanging around. This would be good to prevent
that.

-Dom

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Treat 2004-10-22 12:37:33 Re: timestamp with time zone a la sql99
Previous Message Michael Paesold 2004-10-22 10:14:07 Re: code question: storing INTO relation