Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/libcfa/interpose.c

    re464759 r9d944b2  
    2626
    2727#include "libhdr/libdebug.h"
    28 #include "libhdr/libtools.h"
    2928#include "startup.h"
     29
     30void abortf( const char *fmt, ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__));
    3031
    3132void interpose_startup(void)  __attribute__(( constructor( STARTUP_PRIORITY_CORE ) ));
     
    114115static char abort_text[ abort_text_size ];
    115116
    116 extern "C" {
    117         void abortf( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) {
    118                 void * kernel_data = kernel_abort();
     117void abortf( const char fmt[], ... ) __attribute__ ((__nothrow__, __leaf__, __noreturn__)) {
     118        void * kernel_data = kernel_abort();
     119       
     120        int len;
     121       
     122        if( fmt ) {
     123                va_list args;
     124                va_start( args, fmt );
    119125
    120                 int len;
     126                len = vsnprintf( abort_text, abort_text_size, fmt, args );
    121127
    122                 if( fmt ) {
    123                         va_list args;
    124                         va_start( args, fmt );
     128                va_end( args );
    125129
    126                         len = vsnprintf( abort_text, abort_text_size, fmt, args );
     130                __lib_debug_write( STDERR_FILENO, abort_text, len );
     131                __lib_debug_write( STDERR_FILENO, "\n", 1 );
     132        }
    127133
    128                         va_end( args );
    129 
    130                         __lib_debug_write( STDERR_FILENO, abort_text, len );
    131                         __lib_debug_write( STDERR_FILENO, "\n", 1 );
    132                 }
    133 
    134                 len = snprintf( abort_text, abort_text_size, "Cforall Runtime error (UNIX pid:%ld)\n", (long int)getpid() ); // use UNIX pid (versus getPid)
    135                 __lib_debug_write( STDERR_FILENO, abort_text, len );
     134        len = snprintf( abort_text, abort_text_size, "Cforall Runtime error (UNIX pid:%ld)\n", (long int)getpid() ); // use UNIX pid (versus getPid)
     135        __lib_debug_write( STDERR_FILENO, abort_text, len );
    136136
    137137
    138                 kernel_abort_msg( kernel_data, abort_text, abort_text_size );
     138        kernel_abort_msg( kernel_data, abort_text, abort_text_size );
    139139
    140                 libc_abort();
    141         }
     140        libc_abort();
    142141}
Note: See TracChangeset for help on using the changeset viewer.