Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. #include <unistd.h>
  2. #include <fcntl.h>
  3. #include <limits.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. int main()
  7. {
  8. int fd;
  9. if(0>(fd = open("DELETED", O_CREAT|O_RDWR|O_CLOEXEC, 0600))) return perror("open"),1;
  10. static char const msg[]="got men";
  11. (void)write(fd, msg, sizeof(msg));
  12. if(0>(unlink("DELETED"))) return perror("unlink"),1;
  13. char buf[128];
  14. sprintf(buf,"cat /proc/%ld/fd/%d", (long)getpid(), fd);
  15. system(buf);
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement