Re: Undoing chroot?

Paul Menage (pmenage@ensim.com)
Fri, 26 Jan 2001 14:15:56 -0800


In article <0C01A29FBAE24448A792F5C68F5EA47D04E323@nasdaq.ms.ensim.com>,
you write:
>
>So how do you reverse a CHROOT?
>

Assuming your process doesn't drop its root privileges, before you do
the initial chroot() you could do:

old_root = open("/", O_RDONLY);

Then later do

fchdir(oldroot);
chroot(".");

But the cleaner and more portable solution is probably to have a child
process executing inside the chroot, and have its parent eject the CD
when the child exists.

Paul
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/