X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 34AB35362B for ; Fri, 22 Apr 2005 17:36:40 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61134-04 for ; Fri, 22 Apr 2005 20:36:32 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 376A45361A for ; Fri, 22 Apr 2005 17:36:31 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j3MKaU9O035537 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 22 Apr 2005 14:36:32 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j3MKaUtp094145; Fri, 22 Apr 2005 14:36:30 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j3MKaUh9094144; Fri, 22 Apr 2005 14:36:30 -0600 (MDT) (envelope-from mfuhr) Date: Fri, 22 Apr 2005 14:36:30 -0600 From: Michael Fuhr To: Tom Lane Cc: pgsql-sql@postgresql.org Subject: Re: C function - other process Message-ID: <20050422203629.GA94052@winnie.fuhr.org> References: <20050422211800.241cf201@localhost> <12255.1114198795@sss.pgh.pa.us> <20050422200150.GA93845@winnie.fuhr.org> <12489.1114200468@sss.pgh.pa.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <12489.1114200468@sss.pgh.pa.us> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200504/333 X-Sequence-Number: 21226 On Fri, Apr 22, 2005 at 04:07:48PM -0400, Tom Lane wrote: > > Execing some new program is safe enough, although you might wish to > explicitly close the various sockets the backend holds to make sure > the new program doesn't maliciously scribble on them. Is there a way to find out which fds to close, or should a function just close everything from, say, 3 to (assuming that 0, 1, and 2 are stdin, stdout, and stderr)? I could think of non-portable ways like looking under /proc//fd, but I was wondering if the backend keeps track of its fds somewhere. Thanks. -- Michael Fuhr http://www.fuhr.org/~mfuhr/