title: Reading from FIFO after unlink()
body: <p>I have created a FIFO, wrote to it and unlinked it.
  To my surprise I was able to read data from the fifo after unlinking, why is that?</p>
  
  <pre><code>#include &lt;fcntl.h&gt;
  #include &lt;sys/stat.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;sys/wait.h&gt;
  
  #define MAX_BUF 256
  int main()
  {
      int fd;
      char * myfifo = "/tmp/myfifo";
  
      /* create the FIFO (named pipe) */
      mkfifo(myfifo, 0666);
  
      int pid = fork();
      if (pid != 0)
      {
          /* write "Hi" to the FIFO */
          fd = open(myfifo, O_WRONLY);
          write(fd, "Hi", sizeof("Hi"));
          close(fd);
  
          /* remove the FIFO */
          unlink(myfifo);
      }
      else 
      {
          wait(NULL);
          char buf[MAX_BUF];
  
          /* open, read, and display the message from the FIFO */
          fd = open(myfifo, O_RDONLY);
          read(fd, buf, MAX_BUF);
          printf("Received: %s\n", buf);
          close(fd);
  
          return 0;
      }
  
  
      return 0;
  }
  </code></pre>