From owner-freebsd-questions Thu Apr 18 13:50:40 2002 Delivered-To: freebsd-questions@freebsd.org Received: from stereophonic.noops.org (adsl-66-127-227-196.dsl.sntc01.pacbell.net [66.127.227.196]) by hub.freebsd.org (Postfix) with SMTP id 7A0BE37B41A for ; Thu, 18 Apr 2002 13:50:30 -0700 (PDT) Received: (qmail 6159 invoked by uid 1000); 18 Apr 2002 20:50:31 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 18 Apr 2002 20:50:31 -0000 Date: Thu, 18 Apr 2002 13:50:31 -0700 (PDT) From: Thomas Cannon To: Ceri Davies Cc: , Subject: Re: I think this could be better In-Reply-To: <20020418203742.GA10603@submonkey.net> Message-ID: <20020418134824.E5528-100000@stereophonic.noops.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > While you're probably right to be concerned at use of a PID as a temporary > filename, in this instance I'm not sure it's so terrible : > > {setantae@rhadamanth}-{/tmp} $ ln -s /etc.old/passwd install.35223 > {setantae@rhadamanth}-{/tmp} # ls -l > total 154 > -r--r--r-- 1 root wheel 11 Apr 18 17:00 .X0-lock > drwxrwxrwt 2 root wheel 512 Apr 18 17:00 .X11-unix > -rw-r--r-- 1 setantae wheel 149989 Apr 18 21:03 foo > lrwxr-xr-x 1 setantae wheel 15 Apr 18 21:26 install.35223 -> /etc.old/passwd > -rw-r--r-- 1 rasputin wheel 37 Apr 18 17:24 wtf > {setantae@rhadamanth}-{/tmp} $ su > Password: > {root@rhadamanth}-{/tmp} # mkdir -p install.35223 > mkdir: install.35223: Permission denied True, true... but instead of linking a file and then having the mkdir clobber it, just make a dir and put links in it. Then things go bad. "mkdir -p" won't fail (or even complain) if the directory already exists: [tcannon@stereophonic]$ mkdir -p foo [tcannon@stereophonic]$ sudo su [root@stereophonic]# mkdir -p foo [root@stereophonic]# Cheers, -tcannon -- Thomas Cannon, CISSP, FNCNE, CCDP, CCNP, SCSA, SCNA, CCDP, CCNA Unified Computing (415) 533-5294 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message