1
0
forked from bip/bip

Merge branch 'master' into bip08

This commit is contained in:
Arnaud Cornet 2008-12-29 09:15:44 +01:00
commit 3f895fa6ea
4 changed files with 46 additions and 16 deletions

View File

@ -11,7 +11,7 @@ AC_ARG_ENABLE(debug,
[ enable_debug=$enableval ],
[ enable_debug=no ])
AM_CONDITIONAL(DEBUG, test x$enable_debug = xtrue)
AM_CONDITIONAL(DEBUG, test x$enable_debug = xyes)
case $enable_debug in
yes)
@ -24,11 +24,20 @@ no)
AC_MSG_ERROR(bad value ${enable_debug} for --enable-debug)
esac
backtrace=
if test x$enable_debug = xyes ; then
AC_CHECK_FUNC(backtrace_symbols_fd, [
AC_DEFINE(HAVE_BACKTRACE, [], [Use Glibcs backtrace function on fatal()])
LDFLAGS="-rdynamic $LDFLAGS"
backtrace="(with backtrace)"
])
fi
AC_ARG_ENABLE(oidentd,
[ --enable-oidentd Enable oidentd support (bip overwrites ~/.oidentd.conf with this on!)],
enable_oidentd=yes
AC_DEFINE([HAVE_OIDENTD], [], [Enable oidentd.conf management support]),
[enable_oidentd=no]
enable_oidentd=yes
AC_DEFINE([HAVE_OIDENTD], [], [Enable oidentd.conf management support]),
[enable_oidentd=no]
)
AM_CONDITIONAL(OIDENTD, test x$enable_identd = xyes)
@ -39,16 +48,15 @@ AC_ARG_ENABLE(openssl,
[ enable_openssl=yes ])
if test "x$enable_openssl" = "xyes" ; then
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [],
[AC_MSG_ERROR([library 'crypto' is required for OpenSSL support])])
AC_CHECK_LIB(ssl, SSL_read, [],
[AC_MSG_ERROR(
[library 'ssl' is required for OpenSSL support])],
-lcrypto)
AC_CHECK_LIB(crypto, CRYPTO_new_ex_data, [], [
AC_MSG_ERROR([library 'crypto' is required for OpenSSL support])
], -lcrypto)
AC_CHECK_LIB(ssl, SSL_read, [], [
AC_MSG_ERROR([library 'ssl' is required for OpenSSL support])
])
fi
AC_OUTPUT(Makefile src/Makefile samples/Makefile)
echo OPENSSL: $enable_openssl
echo DEBUG: $enable_debug
echo DEBUG: $enable_debug $backtrace
echo OIDENTD: $enable_oidentd

View File

@ -1,5 +1,8 @@
/* src/config.h.in. Generated from configure.in by autoheader. */
/* Use Glibcs backtrace function on fatal() */
#undef HAVE_BACKTRACE
/* Define to 1 if you have the `crypto' library (-lcrypto). */
#undef HAVE_LIBCRYPTO

View File

@ -1631,7 +1631,7 @@ static int irc_mode(struct link_server *server, struct line *line)
if (!hash_includes(&channel->ovmasks, nick))
return ERR_PROTOCOL;
ovmask = (long int)hash_get(&channel->ovmasks, nick);
ovmask = (long int)hash_remove(&channel->ovmasks, nick);
if (add)
ovmask |= NICKHALFOP;
else
@ -1647,7 +1647,7 @@ static int irc_mode(struct link_server *server, struct line *line)
if (!hash_includes(&channel->ovmasks, nick))
return ERR_PROTOCOL;
ovmask = (long int)hash_get(&channel->ovmasks, nick);
ovmask = (long int)hash_remove(&channel->ovmasks, nick);
if (add)
ovmask |= NICKVOICED;
else

View File

@ -198,15 +198,34 @@ void mylog(int level, char *fmt, ...)
va_end(ap);
}
#ifdef HAVE_BACKTRACE
#include <execinfo.h>
void print_trace(void)
{
void *array[32];
size_t size;
size_t i;
size = backtrace(array, 32);
fflush(conf_global_log_file);
backtrace_symbols_fd(array, size, fileno(conf_global_log_file));
}
#endif
extern char *conf_pid_file;
void fatal(char *fmt, ...)
{
va_list ap;
va_start(ap, fmt);
_mylog(LOG_FATAL, fmt, ap);
va_end(ap);
#ifdef HAVE_BACKTRACE
print_trace();
#endif
exit(200);
}