_die.c (505B)
1 /* Written by Kris Maglione <maglione.k at Gmail> */ 2 /* Public domain */ 3 #include <sys/types.h> 4 #include <signal.h> 5 #include <unistd.h> 6 #include <fmt.h> 7 #include "util.h" 8 9 void 10 _die(char *file, int line, char *msg, ...) { 11 va_list ap; 12 13 va_start(ap, msg); 14 fprint(2, "%s: dieing at %s:%d: %s\n", 15 argv0, file, line, 16 vsxprint(msg, ap)); 17 va_end(ap); 18 19 kill(getpid(), SIGABRT); 20 abort(); /* Adds too many frames: 21 * _die() 22 * abort() 23 * raise(SIGABRT) 24 * kill(getpid(), SIGABRT) 25 */ 26 }