> Yes, for systems with O_NOFOLLOW, that is a perfect (efficient, race
> free) solution. For systems without O_NOFOLLOW, just moving the
> lstat() and the open() close to each other
Actually moving the lstat() _after_ the open() totally removes the
race for inode-less filesystems. The following should be equivalent
to open(O_NOFOLLOW):
fd = open(path);
lstat(path, &st1);
fstat(fd, &st2);
if (st1.st_ino != st2.st_ino)
/* ELOOP */;
The above should be no less efficient than what applications do now:
lstat(path, &st1)
/* ... */
fd = open(path)
fstat(fd, &st2)
if (st1.st_ino != st2.st_ino)
/* ELOOP */;
Miklos
_______________________________________________
Bug-findutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-findutils