# define __GT_DIR 1 /* create a directory */
# define __GT_NOCREATE 2 /* just find a name not currently in use */
-enum __libc_message_action
-{
- do_message = 0, /* Print message. */
- do_abort = 1 << 0, /* Abort. */
-};
-
/* Print out MESSAGE (which should end with a newline) on the error output
and abort. */
extern void __libc_fatal (const char *__message)
__attribute__ ((__noreturn__));
-extern void __libc_message (enum __libc_message_action action,
- const char *__fnt, ...) attribute_hidden;
+_Noreturn void __libc_message (const char *__fnt, ...) attribute_hidden;
extern void __fortify_fail (const char *msg) __attribute__ ((__noreturn__));
libc_hidden_proto (__fortify_fail)
__malloc_assert (const char *assertion, const char *file, unsigned int line,
const char *function)
{
- __libc_message (do_abort, "\
-Fatal glibc error: malloc assertion failure in %s: %s\n",
+ __libc_message ("Fatal glibc error: malloc assertion failure in %s: %s\n",
function, assertion);
__builtin_unreachable ();
}
malloc_printerr (const char *str)
{
#if IS_IN (libc)
- __libc_message (do_abort, "%s\n", str);
+ __libc_message ("%s\n", str);
#else
__libc_fatal (str);
#endif
/* Abort with an error message. */
void
-__libc_message (enum __libc_message_action action, const char *fmt, ...)
+__libc_message (const char *fmt, ...)
{
va_list ap;
int fd = -1;
WRITEV_FOR_FATAL (fd, iov, nlist, total);
- if ((action & do_abort))
+ total = (total + 1 + GLRO(dl_pagesize) - 1) & ~(GLRO(dl_pagesize) - 1);
+ struct abort_msg_s *buf = __mmap (NULL, total,
+ PROT_READ | PROT_WRITE,
+ MAP_ANON | MAP_PRIVATE, -1, 0);
+ if (__glibc_likely (buf != MAP_FAILED))
{
- total = ((total + 1 + GLRO(dl_pagesize) - 1)
- & ~(GLRO(dl_pagesize) - 1));
- struct abort_msg_s *buf = __mmap (NULL, total,
- PROT_READ | PROT_WRITE,
- MAP_ANON | MAP_PRIVATE, -1, 0);
- if (__glibc_likely (buf != MAP_FAILED))
- {
- buf->size = total;
- char *wp = buf->msg;
- for (int cnt = 0; cnt < nlist; ++cnt)
- wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
- *wp = '\0';
-
- /* We have to free the old buffer since the application might
- catch the SIGABRT signal. */
- struct abort_msg_s *old = atomic_exchange_acq (&__abort_msg,
- buf);
- if (old != NULL)
- __munmap (old, old->size);
- }
+ buf->size = total;
+ char *wp = buf->msg;
+ for (int cnt = 0; cnt < nlist; ++cnt)
+ wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len);
+ *wp = '\0';
+
+ /* We have to free the old buffer since the application might
+ catch the SIGABRT signal. */
+ struct abort_msg_s *old = atomic_exchange_acq (&__abort_msg,
+ buf);
+ if (old != NULL)
+ __munmap (old, old->size);
}
}
va_end (ap);
- if ((action & do_abort))
- /* Kill the application. */
- abort ();
+ /* Kill the application. */
+ abort ();
}
{
/* The loop is added only to keep gcc happy. */
while (1)
- __libc_message (do_abort, "%s", message);
+ __libc_message ("%s", message);
}
libc_hidden_def (__libc_fatal)