title: Write failed, errno 0
body: <p>I have a client server situation in which I receive data using </p>
  
  <pre><code>read(socket, char_buf, BUF_SIZE)
  </code></pre>
  
  <p>and then try to write it into a log file using </p>
  
  <pre><code>write(filefd, char_buf, strlen(char_buf))
  </code></pre>
  
  <p>Strangely enough this fails (write returns -1), and yet the errno is set to 0, and I can print the message, AND the log file descriptor works (I write to it before and after this command). </p>
  
  <p>What's going on??</p>
  
  <p>(Working on Linux kernel 2.4 (homework))</p>