SHARE
TWEET

Untitled

a guest Aug 19th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top