Subject: Re: utmp file format change
To: Andrew Brown <atatat@atatdot.net>
From: Charles M. Hannum <root@ihack.net>
List: tech-userlevel
Date: 09/27/2001 04:21:09
On Wed, 2001-09-26 at 22:44, Andrew Brown wrote:
> >> >True, but since you have to give open a path, you can follow it with a
> >> >call to unlink().
> >>
> >> but i still have to worry about racing someone to opening a file with
> >> a random name that i only want for a short time.  i was thinking of
> >> something like tmpfile(), but different in that (a) it returned a file
> >> descriptor and not a FILE*, and (b) the name never gets created so
> >> there's no need to follow it immediately by a call to unlink().
> >
> >fileno will get around (a). There is no way with our current file systems
> >to get around (b), though tmpfile() does it for you.
> 
> right.  i was thinking of smoething a little more silly like
> 
> 	int f = open(NULL, O_RDWR|O_CREAT|O_UNLINK, 0);
> 
> which would give me back something that had a link count of zero.

Making this a standard feature is a *terrible* idea.  If it wasn't
politically infeasible, I would have made I/O to unlinked files fail
years ago.  This sort of hack makes it nearly impossible to analyze WTF
is going on when something breaks.