Mercurial > noffle
diff src/log.c @ 281:5eece4dfd945 noffle
[svn] * src/log.c,src/log.h: Add Log_fatal() for reporting fatal errors
and exiting, Log_gdbm_fatal() for the the same but specifically as
a GDBM error reporting function, and a new log debug level AUTH for
a forthcoming authentication mechanism.
* src/database.c,src/group.c: Provide new gdbm error function to all
gdbm opens.
* src/noffle.c: Add atexit() to always close databases on a program-
inspired exit.
* src/content.c,src/dynamicstring.c,src/fetchlist.c,src/filter.c,
src/itemlist.c,src/log.c,src/log.h,src/over.c,src/protocol.h,
src/request.c,src/util.c: Use Log_fatal where appropriate.
author | bears |
---|---|
date | Fri, 27 Dec 2002 21:48:25 +0000 |
parents | 755e03bc7dcf |
children | de7f674d1224 |
line wrap: on
line diff
--- a/src/log.c Tue Dec 24 09:08:59 2002 +0000 +++ b/src/log.c Fri Dec 27 21:48:25 2002 +0000 @@ -1,7 +1,7 @@ /* log.c - $Id: log.c 406 2002-11-10 15:24:43Z bears $ + $Id: log.c 413 2002-12-27 21:48:25Z bears $ */ #if HAVE_CONFIG_H @@ -11,6 +11,7 @@ #include <syslog.h> #include <stdarg.h> #include "common.h" +#include "lock.h" #include "log.h" #include "portable.h" @@ -92,3 +93,25 @@ log.debugMask = mask; } + +/* + * A fatal error. Log it, close down as much as possible and + * exit with EXIT_FAILURE. + */ +void +Log_fatal( const char *fmt, ... ) +{ + DO_LOG( LOG_ERR ); + exit( EXIT_FAILURE ); + /* NOTREACHED */ +} + +/* Fatal error function for gdbm */ +void +Log_gdbm_fatal( const char *msg ) +{ + Log_fatal( "gdbm: %s", msg ); + /* NOTREACHED */ +} + +