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:
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++) {
O_ CLOEXEC | O_NOFOLLOW | O_DIRECTORY | O_RDONLY);
fd = open(dirfd, component,
fchdir(fd);
close(dirfd);
dirfd = fd;
}
close(fd);
mount(source, ".", ...);