title: When I try to open a fifo O_WRONLY I get a "No such device or address" error
body: <p>In my code I create a fifo named "my_fifo", if I open it in <code>O_WRONLY | O_NONBLOCK</code> mode, open() returns a -1 and an error number of "No such device or address", on the other hand, if I open the fifo in <code>O_RDONLY | O_NONBLOCK</code> mode, it works perfectly. Why is this happening? Is there something I'm doing wrong?</p>
  
  <pre><code>#include &lt;sys/types.h&gt;
  #include &lt;sys/stat.h&gt;
  #include &lt;fcntl.h&gt;
  #include &lt;unistd.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(int argc, char *argv[])
  {
  
      char *fifoname = "my_fifo";
      mkfifo(fifoname, 0666);
  
      int fd;
      if ((fd = open(fifoname, O_WRONLY | O_NONBLOCK)) == -1)
      {
          perror("open pipe");
          exit(EXIT_FAILURE);
      }
  
      close(fd);
  
      exit(EXIT_SUCCESS);
  }
  </code></pre>