title: open() blocks when trying to open pipe for reading
body: <p>I have two processes, a server and a client, that should communicate via pipes (C++, Linux).
  The server opens the pipe with the <code>O_RDONLY</code> flag, and the client with <code>O_WRONLY</code>.
  However, the server blocks at the <code>open</code> function, while the client seems to run successfully (the <code>open</code> function returns success and so do the <code>write</code> functions).</p>
  
  <p>I have read that if the <code>O_NONBLOCK</code> flag is set, the read function will continue, but I don't want it to continue if no client is connected - it is ok to block <strong>until a client is connected</strong>, but in my case it remains blocked even after the client finishes running...</p>
  
  <p>Can you plese tell me what I'm doing wrong...?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>// Server side
  int pipe;
  int status, nr_read = 0;
  
  status = mkfifo(FIFO_NAME, 0666);
  if (status &lt; 0)
  {
      // If the file already exists, delete it
      unlink(FIFO_NAME);
  
      // Try again
      status = mkfifo(FIFO_NAME, 0666);
  
      if(status &lt; 0)
      {
          printf("mkfifo error: %d\n", status);
          return status;
      }
  }
  
  pipe = open(FIFO_NAME, O_RDONLY);
  printf("Never gets here...\n");
  [...]
  nr_read = read(pipe, my_char_array, CHAR_ARRAY_SIZE);
  [...]
  close(pipe);
  unlink(FIFO_NAME);
  </code></pre>
  
  <p>It never gets to the "printf" line...</p>
  
  <pre><code>// Client side:
  int pipe, nr_sent = 0;
  int status = 0;
  
  pipe = open(FIFO_NAME, O_WRONLY);
  if (pipe &lt; 0)
  {
      printf("open fifo error: %d\n", status);
      return pipe;
  }
  
  [...]
  nr_sent = write(pipe, my_char_array, CHAR_ARRAY_LENGTH);
  [...]
  close(pipe);
  </code></pre>
  
  <hr>
  
  <p><strong>EDIT</strong></p>
  
  <p>I didn't mention the line
  <code>#define FIFO_NAME "MYFIFO"</code></p>
  
  <p>... and here was the problem:
  as Jody Hagins said, the path being a relative one and the processes being started from different folders, they were trying to open different files.</p>