From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 13 16:26:34 2007 Return-Path: X-Original-To: hackers@freebsd.org Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0765216A46D; Wed, 13 Jun 2007 16:26:34 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from www.pkgsrc-box.org (www.ostsee-abc.de [62.206.222.50]) by mx1.freebsd.org (Postfix) with ESMTP id AF29713C48C; Wed, 13 Jun 2007 16:26:33 +0000 (UTC) (envelope-from joerg@britannica.bec.de) Received: from britannica.bec.de (www.pkgsrc-box.org [127.0.0.1]) by www.pkgsrc-box.org (Postfix) with ESMTP id 1025DE7A3F9; Wed, 13 Jun 2007 16:26:31 +0000 (UTC) Received: by britannica.bec.de (Postfix, from userid 1000) id 4AF697D3C; Wed, 13 Jun 2007 18:26:00 +0200 (CEST) Date: Wed, 13 Jun 2007 18:25:59 +0200 From: Joerg Sonnenberger To: freebsd-hackers@freebsd.org, hackers@freebsd.org Message-ID: <20070613162559.GA5093@britannica.bec.de> Mail-Followup-To: freebsd-hackers@freebsd.org, hackers@freebsd.org References: <466F86C6.7010006@u.washington.edu> <20070613123213.GE98927@bunrab.catwhisker.org> <46700CAE.6020902@u.washington.edu> <20070613161552.GA83292@keira.kiwi-computer.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070613161552.GA83292@keira.kiwi-computer.com> User-Agent: Mutt/1.5.13 (2006-08-11) Cc: Subject: Re: Using shell commands versus C equivalents X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2007 16:26:34 -0000 On Wed, Jun 13, 2007 at 11:15:52AM -0500, Rick C. Petty wrote: > Another improvement made by using stat(2)/chmod(2) over chmod(1) using > system(3) variants is the protection against malicious filenames. The > original code should have used fork/execv instead anyway. To be precise, this case should use open/fstat/fchmod to avoid another bunch of race conditions. Joerg