Back to index

glibc  2.9
Functions | Variables
assert-perr.c File Reference
#include <assert.h>
#include <libintl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sysdep.h>
#include <unistd.h>

Go to the source code of this file.

Functions

void __assert_perror_fail (int errnum, const char *file, unsigned int line, const char *function)

Variables

const char * __progname

Function Documentation

void __assert_perror_fail ( int  errnum,
const char *  file,
unsigned int  line,
const char *  function 
)

Definition at line 46 of file assert-perr.c.

{
  char errbuf[1024];
  char *buf;

#ifdef FATAL_PREPARE
  FATAL_PREPARE;
#endif

  if (__asprintf (&buf, _("%s%s%s:%u: %s%sUnexpected error: %s.\n"),
                __progname, __progname[0] ? ": " : "",
                file, line,
                function ? function : "", function ? ": " : "",
                __strerror_r (errnum, errbuf, sizeof errbuf)) >= 0)
    {
      /* Print the message.  */
      (void) __fxprintf (NULL, "%s", buf);
      (void) fflush (stderr);

      /* We have to free the buffer since the appplication might catch the
        SIGABRT.  */
      free (buf);
    }
  else
    {
      /* At least print a minimal message.  */
      static const char errstr[] = "Unexpected error.\n";
      __libc_write (STDERR_FILENO, errstr, sizeof (errstr) - 1);
    }

  abort ();
}

Here is the call graph for this function:


Variable Documentation

Definition at line 24 of file init-misc.c.