Comment 10 for bug 1476662

On 2015-07-30 18:46:50, Serge Hallyn wrote:
> Yup, that race is there in theory. This appears to be yet another
> reason to push for a 'fdmount/mountat' function. But lacking that I'm
> not sure how we can prevent this.
> Do you have any suggestions?

You could split all of the path components up into an array (or however
you want to iterate over them) and then walk each component of the path
like so:

for (component = components[0]; component; component++) {
  fd = open(dirfd, component,
  dirfd = fd;
mount(source, ".", ...);