title: fread() reading from a descriptor based on a pipe sets error, not EOF where there is no data
body: <p>I need to read with fread() the stuff from the read end of the pipe.</p>
  
  <p>But while i expect the fread() to set EOF when there is nothing in the pipe, it instead sets the error indicator. I have checked the posix and C standards and found no clue there. Probably i'm doing something unintended (read, silly), right:)</p>
  
  <p>Here's the excerpt:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;fcntl.h&gt;
  
  int main()
  {
     char buf[128];
     FILE *f;
     int pipe_fd[2], n;
  
     pipe(pipe_fd);
     fcntl(pipe_fd[0], F_SETFL, O_NONBLOCK);
  
     f=fdopen(pipe_fd[0], "r");
     n=fread(buf, 1, 1, f);
     printf("read: %d, Error: %d, EOF: %d\n", n, ferror(f), feof(f));
  
     return 0;
  }
  </code></pre>