Back to index

glibc  2.9
Functions
errnobug.c File Reference
#include <errno.h>
#include <stdio.h>
#include <unistd.h>

Go to the source code of this file.

Functions

int main (void)

Function Documentation

int main ( void  )

Definition at line 26 of file errnobug.c.

{
  int fd[2];
  FILE *f;

  /* Get a stream that cannot seek.  */

  if (pipe (fd))
    {
      perror ("pipe");
      return 1;
    }
  f = fdopen (fd[1], "w");
  if (f == NULL)
    {
      perror ("fdopen");
      return 1;
    }

  errno = 0;
  if (fputs ("fnord", f) == EOF)
    {
      perror ("fputs");
      return 1;
    }

  if (errno)
    {
      perror ("errno gratuitously set -- TEST FAILED");
      return 1;
    }

  puts ("Test succeeded.");
  return 0;
}

Here is the call graph for this function: