Oystein Viggen wrote: >* [Craig Allan Jeffree] > >>This would just keep going back a step. "foo" could be changed at any >>point between its discovery and the open syscall. Obviously the user >>could look at the directory listing then run "rm -r foo", but in the >>time it takes for them to type the command someone else could change the >>directory tree - that is always going to be racey. But internally to rm >>how can the discovery of a directory (from the directory recurse not the >>command line) be kept atomic with the entering of that directory? >> > >O_NOFOLLOW should take care of directory symlinks, and opening "." should >take care of the tree being moved. The worst think I can think of then >is creating new files or directories to make the unlinking of the >directories fail, but this is not really a problem, as it has no adverse >effect. > >The discovery of the directory is not atomic with entering the >directory, but the trick is in the open(), which is an atomic >operation. If the directory is removed or replaced by a symlink, open >will fail, and you can handle the error. If not, open will succeed, and >you are guaranteed that the fchdir will also put you in the correct >directory no matter what somebody does to the directory between the open >and the fchdir. > >Oystein > I think I understand a bit better now, I forgot about the O_NOFOLLOW which clears up most scenarios and everything else I was thinking of wouldn't really be harmful anyway.
Regards, Craig. _______________________________________________ Help-hurd mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/help-hurd
