Mercurial > noffle
comparison 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 |
comparison
equal
deleted
inserted
replaced
280:9c54bf672ca1 | 281:5eece4dfd945 |
---|---|
1 /* | 1 /* |
2 log.c | 2 log.c |
3 | 3 |
4 $Id: log.c 406 2002-11-10 15:24:43Z bears $ | 4 $Id: log.c 413 2002-12-27 21:48:25Z bears $ |
5 */ | 5 */ |
6 | 6 |
7 #if HAVE_CONFIG_H | 7 #if HAVE_CONFIG_H |
8 #include <config.h> | 8 #include <config.h> |
9 #endif | 9 #endif |
10 | 10 |
11 #include <syslog.h> | 11 #include <syslog.h> |
12 #include <stdarg.h> | 12 #include <stdarg.h> |
13 #include "common.h" | 13 #include "common.h" |
14 #include "lock.h" | |
14 #include "log.h" | 15 #include "log.h" |
15 #include "portable.h" | 16 #include "portable.h" |
16 | 17 |
17 #define MAXLENGTH 240 | 18 #define MAXLENGTH 240 |
18 | 19 |
90 if ( mask != 0 ) | 91 if ( mask != 0 ) |
91 mask |= LOG_DBG_NOFFLE; | 92 mask |= LOG_DBG_NOFFLE; |
92 | 93 |
93 log.debugMask = mask; | 94 log.debugMask = mask; |
94 } | 95 } |
96 | |
97 /* | |
98 * A fatal error. Log it, close down as much as possible and | |
99 * exit with EXIT_FAILURE. | |
100 */ | |
101 void | |
102 Log_fatal( const char *fmt, ... ) | |
103 { | |
104 DO_LOG( LOG_ERR ); | |
105 exit( EXIT_FAILURE ); | |
106 /* NOTREACHED */ | |
107 } | |
108 | |
109 /* Fatal error function for gdbm */ | |
110 void | |
111 Log_gdbm_fatal( const char *msg ) | |
112 { | |
113 Log_fatal( "gdbm: %s", msg ); | |
114 /* NOTREACHED */ | |
115 } | |
116 | |
117 |