Date: Wed, 18 May 2005 17:14:56 +0300 From: Giorgos Keramidas <keramida@freebsd.org> To: Max Okumoto <okumoto@ucsd.edu>, Alexander Leidinger <netchild@freebsd.org> Cc: freebsd-security@freebsd.org Subject: Re: cvs commit: src/usr.bin/make job.c Message-ID: <20050518141456.GB40240@orion.daedalusnetworks.priv> In-Reply-To: <hfacmt7wpj.fsf@multivac.sdsc.edu> References: <200505121545.j4CFjENu078768@repoman.freebsd.org> <20050512180743.6z1h22fldwksgw4w@netchild.homeip.net> <hfbr7ge2gu.fsf@multivac.sdsc.edu> <42897003.2090005@ucsd.edu> <20050517144446.gibxprydoosokw0k@netchild.homeip.net> <428A23A2.5080108@ucsd.edu> <20050518100548.h8r4qc59c08swoog@netchild.homeip.net> <hfacmt7wpj.fsf@multivac.sdsc.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2005-05-18 01:41, Max Okumoto <okumoto@ucsd.edu> wrote: > Your idea of using mkdtemp() can be fixed by putting a loop > around the code. Each time around the loop would be expensive > but we wouldn't be doing that to often anyway. > > loop: > mkdtemp(template) > mkfifo(tempalte + "/fifo") > if error remove temp directory, restore template and loop. > > Or better yet, if someone could create an equiv function in libc > so I don't have to maintain it in make(1) :-) Do any other > programs need the ability to make a temp fifo? > > Personally, I don't think it is a risk, but I wanted other > peoples opinions, before I tried to fix a non-issue. :-) Does this really need to be of the form DIR/fifo ? I haven't looked at the code that uses the fifo at all, so I risk being extremely out of topic here, but why wouldn't a temporary fifo created with a name obtained from mkstemp() work too? A directory won't be needed if the fifo name is created by mkstemp() and then passed directly to mkfifo(2). Then there is still a (small?) possibility for a race, but a subsequent invocation of mkstemp() is almost guaranteed to work, unless mkstemp() is severely broken.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050518141456.GB40240>