+2004-12-11 Kevin L Mitchell <klmitch@mit.edu>
+
+ * ircd/*.c: use new assert() in ircd_log.h in preference to system
+ assert()
+
+ * ircd/umkpasswd.c: use new assert in ircd_log.h; add necessary
+ glue so that umkpasswd will successfully compile and link
+
+ * ircd/test/ircd_chattr_t.c: comment out include of assert.h since
+ there are no calls to assert()
+
+ * ircd/ircd_log.c: add sentinel (log_inassert) to prevent assert()
+ from looping should there be an assertion failure somewhere in the
+ logging subsystem
+
+ * include/ircd_log.h: custom implementation of assert() that calls
+ log_write()
+
2004-11-21 Michael Poole <mdpoole@troilus.org>
* ircd/channel.c (mode_parse_upass): Allow forced mode changes to
#include <stdarg.h> /* va_list */
#define INCLUDED_stdarg_h
#endif
+#ifndef INCLUDED_stdlib_h
+#include <stdlib.h> /* abort */
+#define INCLUDED_stdlib_h
+#endif
struct Client;
extern int log_feature_mark(int flag);
extern void log_feature_report(struct Client *to, int flag);
+extern int log_inassert;
+
#endif /* INCLUDED_ircd_log_h */
+
+/* The rest of this file implements our own custom version of assert.
+ * This version will log the assertion failure using the LS_SYSTEM log
+ * stream, thus putting the assertion failure message into a useful
+ * place, rather than elsewhere, as is currently the case...
+ */
+
+/* We've been included twice; clean up before creating assert() again */
+#ifdef _ircd_log_assert
+# undef _ircd_log_assert
+# undef assert
+#endif
+
+/* gcc has a nice way of hinting that an expression is expected to
+ * produce a specific result, which can improve optimization.
+ * Unfortunately, all the world's not gcc (at least, not yet), and not
+ * all gcc's support it. I don't know exactly when it appeared, but
+ * it does appear to be in all versions from 3 and up. So, we'll
+ * create a dummy define if (we think) this version of gcc doesn't
+ * have it...
+ */
+#ifndef _log_builtin_expect
+# define _log_builtin_expect
+# if __GNUC__ < 3
+# define __builtin_expect(expr, expect) (expr)
+# endif
+#endif
+
+/* let's try not to clash with the system assert()... */
+#ifndef assert
+# ifdef NDEBUG
+# define assert(expr) ((void)0)
+# else
+# define assert(expr) \
+ ((void)(__builtin_expect(!!(expr), 1) ? 0 : \
+ (__builtin_expect(log_inassert, 0) ? (abort(), 0) : \
+ ((log_inassert = 1), /* inhibit looping in assert() */ \
+ log_write(LS_SYSTEM, L_CRIT, 0, "Assertion failure at %s:%d: " \
+ "\"%s\"", __FILE__, __LINE__, #expr), abort(), 0))))
+# endif
+#endif
#include "ircd_alloc.h"
#include "ircd_events.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "s_debug.h" /* Debug */
#include "s_user.h" /* TARGET_DELAY */
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/** Stores free target information for a particular user. */
#include "sys.h"
#include "whowas.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ircd.h"
#include "ircd_alloc.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "list.h"
#include "s_debug.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/** List of all connection classes. */
static struct ConnectionClass* connClassList;
#include "class.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "list.h"
#include "msgq.h"
#include "send.h"
#include "struct.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/** Find the shortest non-zero ping time attached to a client.
#include "ircd_alloc.h"
#include "ircd_chattr.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "send.h"
#include "sys.h" /* MIN */
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/*
#include "ircd_alloc.h"
#include "ircd.h"
#include "ircd_events.h"
+#include "ircd_log.h"
#include "send.h"
#include "msg.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
/** Structure describing a destruction event. */
#include "ircd_log.h"
#include "s_debug.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <fcntl.h>
#include <sys/devpoll.h>
#include "ircd_log.h"
#include "s_debug.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <sys/types.h>
#ifdef HAVE_STDINT_H
#include "ircd_log.h"
#include "s_debug.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <signal.h>
#include <sys/event.h>
#include "ircd_log.h"
#include "s_debug.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <sys/poll.h>
#include <sys/socket.h>
# endif
#endif
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <string.h> /* needed for bzero() on OS X */
#include <sys/socket.h>
#include "fileio.h"
#include "ircd_alloc.h" /* MyMalloc, MyFree */
+#include "ircd_log.h" /* assert */
-#include <assert.h> /* assert */
+/* #include <assert.h> -- Now using assert in ircd_log.h */ /* assert */
#include <fcntl.h> /* O_RDONLY, O_WRONLY, ... */
#include <stdio.h> /* BUFSIZ, EOF */
#include <sys/stat.h> /* struct stat */
#include "sys.h" /* FALSE bleah */
#include "whocmds.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "channel.h"
#include "ircd_alloc.h"
#include "ircd_chattr.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "ircd.h"
#include "struct.h"
#include "sys.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <limits.h>
#include <stdlib.h>
#include <string.h>
#include "version.h"
#include "whowas.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include "config.h"
#include "ircd_alloc.h"
+#include "ircd_log.h"
#include "ircd_string.h"
#include "s_debug.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
static void nomem_handler(void);
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <netdb.h>
#include <string.h>
#include "ircd_crypt.h"
#include "ircd_alloc.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_string.h"
#include "s_debug.h"
#include "ircd_crypt_plain.h"
#include "ircd_crypt_smd5.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <unistd.h>
#include <string.h>
#include "config.h"
#include "ircd_crypt.h"
#include "ircd_crypt_native.h"
+#include "ircd_log.h"
#include "s_debug.h"
#include "ircd_alloc.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <unistd.h>
#ifdef HAVE_CRYPT_H
#include <crypt.h>
#include "config.h"
#include "ircd_crypt.h"
#include "ircd_crypt_plain.h"
+#include "ircd_log.h"
#include "s_debug.h"
#include "ircd_alloc.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <unistd.h>
/** Just sends back the supplied password.
#include "config.h"
#include "ircd_crypt.h"
#include "ircd_crypt_smd5.h"
+#include "ircd_log.h"
#include "ircd_md5.h"
#include "s_debug.h"
#include "ircd_alloc.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
#include <unistd.h>
#include "ircd_snprintf.h"
#include "s_debug.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include "sys.h" /* FALSE bleah */
#include "whowas.h" /* whowas_realloc */
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "send.h"
#include "struct.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include <time.h>
#include <unistd.h>
+int log_inassert = 0;
+
#define LOG_BUFSIZE 2048 /**< Maximum length for a log message. */
/** Select default log level cutoff. */
#include "ircd.h"
#include "ircd_chattr.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "match.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ircd_reply.h"
#include "client.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_snprintf.h"
#include "msg.h"
#include "msgq.h"
#include "s_debug.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/** Report a protocol violation warning to anyone listening. This can
#include "res.h"
#include "ircd_reslib.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
#include <sys/time.h>
#include <sys/socket.h>
#include "ircd.h"
#include "ircd_events.h"
+#include "ircd_log.h"
#include "ircd_signal.h"
#include "s_conf.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <signal.h>
/** Counts various types of signals that we receive. */
#include "client.h"
#include "channel.h"
+#include "ircd_log.h"
#include "ircd_snprintf.h"
#include "struct.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <stddef.h>
#include <stdlib.h>
#include "ircd_log.h"
#include "res.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
#include <regex.h>
#include <sys/types.h>
#include "struct.h"
#include "sys.h" /* FALSE bleah */
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/** List of jupes. */
#include "ircd.h"
#include "ircd_alloc.h"
#include "ircd_events.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "listener.h"
#include "struct.h"
#include "whowas.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stddef.h> /* offsetof */
#include <unistd.h> /* close */
#include <string.h>
#include "ircd_alloc.h"
#include "ircd_events.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_osdep.h"
#include "ircd_reply.h"
#include "ircd_snprintf.h"
#include "send.h"
#include "sys.h" /* MAXCLIENTS */
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "client.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "msg.h"
#include "numeric.h"
#include "s_conf.h"
#include "s_user.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
static int send_admin_info(struct Client* sptr)
{
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "numeric.h"
#include "s_bsd.h"
#include "s_user.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
static int send_asll_reply(struct Client *from, struct Client *to, char *server,
#include "client.h"
#include "ircd.h"
#include "ircd_alloc.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/*
#include "ircd.h"
#include "ircd_alloc.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "list.h"
#include "struct.h"
#include "ircd_snprintf.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "s_conf.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* do_clearmode(struct Client *cptr, struct Client *sptr,
#include "client.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "numeric.h"
#include "s_bsd.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* mo_close - oper message handler
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
/*
#include "config.h"
#include "client.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "s_user.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_cprivmsg - generic message handler
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "client.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "numeric.h"
#include "numnicks.h"
#include "supported.h"
#include "version.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_functions execute protocol messages on this server:
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "channel.h"
#include "destruct_event.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
/*
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_bsd.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* ms_desynch - server message handler
#include "client.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_bsd.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "numnicks.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* ms_end_of_burst - server message handler
#include "hash.h"
#include "ircd.h"
#include "ircd_alloc.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "numeric.h"
#include "s_misc.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/*
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "numeric.h"
#include "numnicks.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* mo_get - oper message handler
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "match.h"
#include "s_misc.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "numnicks.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_help - generic message handler
#include "client.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "send.h"
#include "version.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_info - generic message handler
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "list.h"
#include "send.h"
#include "struct.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_invite - generic message handler
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msgq.h"
#include "numeric.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/*
#include "ircd.h"
#include "ircd_chattr.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "match.h"
#include "s_misc.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "send.h"
#include "ircd_features.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_kick - generic message handler
#include "send.h"
#include "whowas.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/*
#include "ircd.h"
#include "ircd_defs.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "match.h"
#include "send.h"
#include "struct.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_links - generic message handler
#include "s_bsd.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "client.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_serv.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_lusers - generic message handler
#include "ircd.h"
#include "ircd_defs.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_snprintf.h"
#include "ircd_string.h"
#include "send.h"
#include "querycmds.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdio.h>
#include <string.h>
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "client.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "match.h"
#include "send.h"
#include <stdlib.h>
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_motd - generic message handler
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/*
#include "ircd.h"
#include "ircd_chattr.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "send.h"
#include "sys.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "client.h"
#include "ircd_chattr.h"
+#include "ircd_log.h"
#include "ircd_relay.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "numeric.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
#if !defined(XXX_BOGUS_TEMP_HACK)
#include "s_misc.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "send.h"
#include "s_conf.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* ms_opmode - server message handler
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "numeric.h"
#include "numnicks.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/*
#include "config.h"
#include "client.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* mr_pass - registration message handler
#include "client.h"
#include "hash.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "ircd.h"
#include "s_debug.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
#include <stdlib.h>
#include "ircd.h"
#include "ircd_chattr.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_relay.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "numeric.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/*
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "numeric.h"
#include "numnicks.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* mo_privs - report operator privileges
#include "ircd.h"
#include "ircd_alloc.h"
#include "ircd_chattr.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "supported.h"
#include "version.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_relay.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "s_conf.h"
#include "s_user.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_pseudo - generic service message handler
#include "channel.h"
#include "client.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_string.h"
#include "struct.h"
#include "s_misc.h"
#include "ircd_reply.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/*
#include "s_conf.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* mo_rehash - oper message handler
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "numeric.h"
#include "numnicks.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* mo_reset - oper message handler
#include "numnicks.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* mo_restart - oper message handler
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "opercmds.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* ms_rpong - server message handler
#include "send.h"
#include "userload.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "numeric.h"
#include "numnicks.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* mo_set - oper message handler
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_snprintf.h"
#include "ircd_string.h"
#include "send.h"
#include "struct.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
/*
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_snprintf.h"
#include "ircd_string.h"
#include "send.h"
#include "struct.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "hash.h"
#include "ircd.h"
#include "ircd_chattr.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "numeric.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "client.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "send.h"
#include "struct.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "client.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_time - generic message handler
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "numeric.h"
#include "numnicks.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_tmpl - generic message handler
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "numnicks.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h> /* for atoi() */
static void do_settopic(struct Client *sptr, struct Client *cptr,
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "match.h"
#include "send.h"
#include "version.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
void do_trace(struct Client *cptr, struct Client *sptr, int parc, char *parv[])
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "match.h"
#include "uping.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "client.h"
#include "ircd.h"
#include "ircd_chattr.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "numeric.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
#include "client.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msgq.h"
#include "s_user.h"
#include "struct.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
static void userhost_formatter(struct Client* cptr, struct Client *sptr, struct MsgBuf* mb)
{
#include "ircd_reply.h"
#include "ircd_string.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "msgq.h"
#include "numeric.h"
#include "s_user.h"
#include "struct.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
static void userip_formatter(struct Client* cptr, struct Client *sptr, struct MsgBuf* mb)
{
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_snprintf.h"
#include "ircd_string.h"
#include "supported.h"
#include "version.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_version - generic message handler
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_wallchops - local generic message handler
#include "config.h"
#include "client.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "numeric.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
#include "config.h"
#include "client.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "numeric.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
#include "client.h"
#include "hash.h"
#include "ircd.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "s_user.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/*
* m_wallvoices - local generic message handler
#include "send.h"
#include "whocmds.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "match.h"
#include "send.h"
#include "whocmds.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/*
#include "hash.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "send.h"
#include "whowas.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
/*
#include <sys/types.h>
#include "ircd.h"
#include "ircd_alloc.h"
+#include "ircd_log.h"
#include "client.h"
#include "s_debug.h"
#include <stdlib.h>
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#ifdef MDEBUG
#include "ircd.h"
#include "ircd_alloc.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "match.h"
#include "s_stats.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "ircd_alloc.h"
#include "ircd_defs.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_snprintf.h"
#include "numeric.h"
#include "s_debug.h"
#include "s_stats.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdarg.h>
#include <string.h>
#include <sys/types.h>
#include "client.h"
#include "ircd.h"
#include "ircd_alloc.h"
+#include "ircd_log.h"
#include "ircd_string.h"
#include "match.h"
#include "s_bsd.h"
#include "s_misc.h"
#include "struct.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ircd_osdep.h"
#include "msgq.h"
+#include "ircd_log.h"
#include "res.h"
#include "s_bsd.h"
#include "sys.h"
* Solaris requires sys/time.h before struct rusage (indirectly) in
* netinet/in.h.
*/
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include "client.h"
#include "ircd.h"
#include "ircd_chattr.h"
+#include "ircd_log.h"
#include "parse.h"
#include "s_bsd.h"
#include "s_misc.h"
#include "send.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/** Add a certain number of bytes to a client's received statistics.
* @param[in,out] cptr Client to update.
#include "ircd_alloc.h"
#include "ircd_chattr.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "msg.h"
#include "whocmds.h"
#include "whowas.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/ioctl.h>
#include "version.h"
#include <arpa/inet.h>
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <fcntl.h>
#include <netdb.h>
#include "struct.h"
#include "sys.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <arpa/inet.h>
#include <errno.h>
#include <fcntl.h>
#include "sys.h"
#include "whowas.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <fcntl.h>
#include <stdarg.h>
#include "config.h"
#include "numeric.h"
+#include "ircd_log.h"
#include "s_debug.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <string.h>
/** Array of Numeric replies, indexed by numeric. */
#include "uping.h"
#include "userload.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <fcntl.h>
#include <netdb.h>
#include <stdio.h>
#include "hash.h"
#include "ircd.h"
#include "ircd_alloc.h"
+#include "ircd_log.h"
#include "ircd_reply.h"
#include "ircd_string.h"
#include "ircd_snprintf.h"
#include "sys.h"
#include "userload.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>
#include "handlers.h" /* m_motd and m_lusers */
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include "client.h"
#include "ircd.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_snprintf.h"
#include "ircd_string.h"
#include "list.h"
#include "struct.h"
#include "sys.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdio.h>
#include <string.h>
* ircd_chattr_t.c - Test file for character attributes
*/
#include "ircd_chattr.h"
-#include <assert.h>
+/* #include <assert.h> -- not used here */
#include <stdio.h>
typedef int (*EvalFn)(char);
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
/* ircu headers */
#include "ircd_alloc.h"
+#include "ircd_log.h" /* for ircd's assert.h */
#include "ircd_string.h"
#include "umkpasswd.h"
#include "s_debug.h"
/* bleah, evil globals */
umkpasswd_conf_t* umkpasswd_conf;
crypt_mechs_t* crypt_mechs_root;
+int log_inassert = 0;
void copyright(void)
{
errno = err;
}
+/* quick implementation of log_write() for assert() call */
+void log_write(enum LogSys subsys, enum LogLevel severity,
+ unsigned int flags, const char *fmt, ...)
+{
+ va_list vl;
+ va_start(vl, fmt);
+ vfprintf(stderr, fmt, vl);
+ fprintf(stderr, "\n");
+ va_end(vl);
+}
+
/* quick and dirty salt generator */
char *make_salt(const char *salts)
{
#include "sys.h"
#include <arpa/inet.h>
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <errno.h>
#include <netdb.h>
#include <stdio.h>
#include "ircd_alloc.h"
#include "ircd_chattr.h"
#include "ircd_features.h"
+#include "ircd_log.h"
#include "ircd_string.h"
#include "list.h"
#include "numeric.h"
#include "sys.h"
#include "msg.h"
-#include <assert.h>
+/* #include <assert.h> -- Now using assert in ircd_log.h */
#include <stdlib.h>
#include <string.h>