Roger Leigh wrote: > You can't reliably (or portably) check if you are in a chroot. Hmm, if you're root you probably can. Something like this (completely untested; probably doesn't even compile):
DIR *d; int fd; struct stat s1, s2; mkdir("temp", 0700); d = opendir("/"); fd = dirfd(d); fstat(fd, &s1); chroot("temp"); fchdir(fd); stat("..", &s2); if (s1.st_dev != s2.st_dev || s1.st_ino != s2.st_ino) { /* we were in a chroot */ } Actually, come to think of it, I wonder if stat'ing "/.." would work... If it does, then you don't even need root. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]