Created
January 16, 2017 17:00
-
-
Save seebs/10dcb7ed22281a880f93daa035fb223c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int | |
main(void) { | |
int root = open("/", O_RDONLY); | |
int rc; | |
printf("root fd: %d\n", root); | |
rc = chroot("f"); | |
printf("chroot(f): %d\n", rc); | |
rc = fchdir(root); | |
printf("fchdir(root): %d\n", rc); | |
rc = chroot("."); | |
printf("chroot(.): %d\n", rc); | |
int r2 = open("/", O_RDONLY); | |
printf("root fd 2: %d\n", r2); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment