From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Earnshaw To: nobody@gcc.gnu.org Cc: gcc-prs@gcc.gnu.org Subject: Re: other/2141: set -C in gccbug not portable Date: Sun, 01 Apr 2001 00:00:00 -0000 Message-id: <20010312141601.6290.qmail@sourceware.cygnus.com> X-SW-Source: 2001-q1/msg02257.html List-Id: The following reply was made to PR other/2141; it has been noted by GNATS. From: Richard Earnshaw To: "Joseph S. Myers" Cc: Rainer Orth , gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, Richard.Earnshaw@arm.com Subject: Re: other/2141: set -C in gccbug not portable Date: Mon, 12 Mar 2001 14:08:32 +0000 > On Mon, 12 Mar 2001, Rainer Orth wrote: > > > How about using a different approach: creating a unique temporary directory > > and storing the gccbug temp files there? This shouldn't be vulnerable to > > temp races and doesn't rely on non-portable options either. > > It's also more prone to DoS attacks than the mktemp method, so mktemp is > still preferable on systems that have it. > > I presume that any systems on which mkdir fails to return a proper exit > status (non-zero if the directory already exists) or follows symlinks also > lack set -C? One or two ideas: Determine if we are root and refuse to run if there is no safe mktemp or whatever. Determine if we are root and then use "su nobody" to create the temporary file. use csh and set the noclobber variable to create the temporary file