X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Flog.c;h=6ac941064b1b80e91c466600dc05a0cbe8933441;hb=1ac31d623afa6873c1cbe691bf8429c03d289ac2;hp=aea97e3bd61457d2f0d371021cfe7cfcb0a306f0;hpb=e1b297303866e8a2f7611515a7e90fba483c7000;p=libucw.git diff --git a/ucw/log.c b/ucw/log.c index aea97e3b..6ac94106 100644 --- a/ucw/log.c +++ b/ucw/log.c @@ -3,6 +3,7 @@ * * (c) 1997--2009 Martin Mares * (c) 2008 Tomas Gavenciak + * (c) 2014 Tomas Valla * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -33,7 +34,9 @@ static void NONRET do_die(void); static int default_log_handler(struct log_stream *ls UNUSED, struct log_msg *m) { // This is a completely bare version of the log-file module. Errors are ignored. - write(2, m->m, m->m_len); + if (write(2, m->m, m->m_len) < 0) + { + } return 0; } @@ -386,6 +389,16 @@ assert_failed(const char *assertion, const char *file, int line) abort(); } +void +assert_failed_msg(const char *assertion, const char *file, int line, const char *fmt, ...) +{ + va_list args; + va_start(args, fmt); + vmsg(L_DEBUG, fmt, args); + msg(L_FATAL, "Assertion `%s' failed at %s:%d", assertion, file, line); + abort(); +} + void assert_failed_noinfo(void) {