Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2014
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <pthread.h>
  2. #include <linux/sched.h>
  3. #include <unistd.h>
  4. #include <stdio.h>
  5.  
  6. extern int unshare(int);
  7.  
  8. static void *
  9. thread_main(void *arg)
  10. {
  11. #ifndef BEES
  12. if (unshare(CLONE_FILES) < 0) {
  13. perror("unshare");
  14. }
  15. #endif
  16. if (close(1) < 0) {
  17. perror("close");
  18. }
  19. return arg;
  20. }
  21.  
  22. int main() {
  23. pthread_t thr;
  24. pthread_create(&thr, 0, thread_main, 0);
  25. pthread_join(thr, 0);
  26. if (write(1, "Bees?\n", 6) != 6) {
  27. perror("write");
  28. return 1;
  29. }
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement