title: Unable to open FIFO for writing
body: <p>'Server' program side:</p>
  
  <pre><code>#define RESP_FIFO_NAME "response"
  
  /* Global Variables */
  char *cmdfifo = CMD_FIFO_NAME; /* Name of command FIFO. */
  char *respfifo = RESP_FIFO_NAME; /* Name of response FIFO. */
  
  int main(int argc, char* argv[]) {
  int infd, outfd; /* FIFO file descriptors. */
  
  ... // blah blah other code here
  
  /* Create command FIFO. */
  if (mkfifo(cmdfifo, FIFO_MODE) == -1) {
      if (errno != EEXIST) {
          fprintf(stderr, "Server: Couldn’t create %s FIFO.\n", CMD_FIFO_NAME);
          exit(1);
      }
  }
  
  /* Create response FIFO. */
  if (mkfifo(respfifo, FIFO_MODE) == -1) {
      if (errno != EEXIST) {
          fprintf(stderr, "Server: Couldn’t create %s FIFO.\n", RESP_FIFO_NAME);
          exit(1);
      }
  }
  /* Open the command FIFO for non-blocking reading. */
  if ((infd = open(cmdfifo, O_RDONLY | O_NONBLOCK)) == -1) {
      fprintf(stderr, "Server: Failed to open %s FIFO.\n", CMD_FIFO_NAME);
      exit(1);
  }
  
          /* Open the response FIFO for non-blocking writes. */
  if ((outfd = open(respfifo, O_WRONLY | O_NONBLOCK)) == -1) {
              fprintf(stderr, "Server: Failed to open %s FIFO.\n", RESP_FIFO_NAME);
              perror(RESP_FIFO_NAME);
              exit(1);
          }
  </code></pre>
  
  <p>The program prints an output of:</p>
  
  <pre><code>Server: Couldn’t create response FIFO.
  </code></pre>
  
  <p>I understand very little on FIFOs as my professor didn't teach it. This was all I was able to manage from reading his examples and lecture notes. I tried without O_NONBLOCK flag but that just causes the program to hang, so it is required. I don't understand why the read FIFO is fine but the write FIFO fails to open.</p>