From owner-freebsd-hackers@FreeBSD.ORG Tue Aug 2 06:19:56 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D5D1916A41F for ; Tue, 2 Aug 2005 06:19:56 +0000 (GMT) (envelope-from qhwt+fbsd@les.ath.cx) Received: from les.ath.cx (15.61.205.61.west.global.alpha-net.ne.jp [61.205.61.15]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1BBED43D45 for ; Tue, 2 Aug 2005 06:19:54 +0000 (GMT) (envelope-from qhwt+fbsd@les.ath.cx) Received: by les.ath.cx (Postfix, from userid 1000) id 3E9141B8762; Tue, 2 Aug 2005 15:19:53 +0900 (JST) Date: Tue, 2 Aug 2005 15:19:53 +0900 From: YONETANI Tomokazu To: diz@linuxpowered.com Message-ID: <20050802061953.GA964@les.ath.cx> References: <51934.68.95.232.238.1122957425.squirrel@68.95.232.238> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <51934.68.95.232.238.1122957425.squirrel@68.95.232.238> User-Agent: Mutt/1.5.9i Cc: freebsd-hackers@freebsd.org Subject: Re: [patch] rc.d/tmp (silly mkdir usage) 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: Tue, 02 Aug 2005 06:19:56 -0000 On Mon, Aug 01, 2005 at 11:37:05PM -0500, diz@linuxpowered.com wrote: > I'm sorry for the previous patch, so here is at least one item that really > bugs me that isn't obfuscation. In short, I don't see any reason to fork > some process to simply "touch" a file (is a filesystem writable) when > built-in shell i/o does this: > > --- /etc/rc.d/tmp.orig Mon Aug 1 23:20:24 2005 > +++ /etc/rc.d/tmp Mon Aug 1 23:22:07 2005 > @@ -48,8 +48,8 @@ > [Nn][Oo]) > ;; > *) > - if (/bin/mkdir -p /tmp/.diskless 2> /dev/null); then > - rmdir /tmp/.diskless > + if ( > /tmp/.diskless 2> /dev/null); then > + rm /tmp/.diskless > else > if [ -h /tmp ]; then > echo "*** /tmp is a symlink to a non-writable area!" > Try this as a non-root user, reboot the system and see what happens: $ ln -s /bin/rm /tmp/.diskless