Subject: Re: funlink() for fun!
To: Roland Dowdeswell <firstname.lastname@example.org>
From: Greg A. Woods <email@example.com>
Date: 07/11/2003 13:58:02
[ On Friday, July 11, 2003 at 11:03:03 (-0400), Roland Dowdeswell wrote: ]
> Subject: Re: funlink() for fun!
> I think that funlink(2) as an idea doesn't really make sense.
> unlink(2) specifically operates on directory entries, not on files.
Unlink(2) may specifically also operate on files as well as the link in
the parent directory, and it will always also operate on the file if
that file has only one link.
Strictly funlink() isn't necessary for secure programming provided you
have fchdir() and given you can always lstat() and then open() and then
fstat() the parent directory in which you need to do the unlink() and
thus to which you need to fchdir() before you call unlink(basename()).
Strictly funlink() is also going to incur a lot more overhead than one
or two additional fchdir() (and open()) calls.
Thus I agree it doesn't make a whole lot of sense to implement funlink()
unless you also want the ability to unlink a file you were handed on
stdin, for example.
Greg A. Woods
+1 416 218-0098; <firstname.lastname@example.org>; <email@example.com>
Planix, Inc. <firstname.lastname@example.org>; VE3TCP; Secrets of the Weird <email@example.com>