From 44b03ba60b02c0166751ece9cd5683b4e6e13e10 Mon Sep 17 00:00:00 2001 From: Martin Baulig Date: Wed, 11 Nov 1998 16:02:01 +0000 Subject: [PATCH] Define LIBGTOP_ENABLE_DEBUG if this parameter is given. 1998-11-11 Martin Baulig * configure.in (--enable-debug): Define LIBGTOP_ENABLE_DEBUG if this parameter is given. (--enable-fatal-warnings): New parameter to make all warnings fatal; define `LIBGTOP_FATAL_WARNINGS' if given. * sysdeps/common/error.c (glibtop_error_r): Use abort () instead of exit () if LIBGTOP_ENABLE_DEBUG. (glibtop_error_io_r): Likewise. (glibtop_warn_r): Call abort () if LIBGTOP_FATAL_WARNINGS. (glibtop_warn_io_r): Likewise. [NOTE: To get a core dump of the libgtop_server, you need to remove all suid/sgid bits and invoke it as a priviledged user.] --- ChangeLog | 16 ++++++++++++++++ acconfig.h | 5 ++++- configure.in | 4 +++- sysdeps/common/error.c | 20 +++++++++++++++++++- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bbccb00e..3d01089f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,19 @@ +1998-11-11 Martin Baulig + + * configure.in (--enable-debug): Define LIBGTOP_ENABLE_DEBUG + if this parameter is given. + (--enable-fatal-warnings): New parameter to make all warnings + fatal; define `LIBGTOP_FATAL_WARNINGS' if given. + + * sysdeps/common/error.c (glibtop_error_r): Use abort () instead + of exit () if LIBGTOP_ENABLE_DEBUG. + (glibtop_error_io_r): Likewise. + (glibtop_warn_r): Call abort () if LIBGTOP_FATAL_WARNINGS. + (glibtop_warn_io_r): Likewise. + + [NOTE: To get a core dump of the libgtop_server, you need to + remove all suid/sgid bits and invoke it as a priviledged user.] + 1998-11-08 Raja R Harinath * Makefile.am (support): Don't build if not BUILD_GNOME_SUPPORT. diff --git a/acconfig.h b/acconfig.h index 8cc94644..f59f3d5a 100644 --- a/acconfig.h +++ b/acconfig.h @@ -118,7 +118,6 @@ #undef HAVE_LIBTIFF #undef HAVE_LIBZ #undef HAVE_LIBPNG -#undef GNOME_ENABLE_DEBUG #undef HAVE_GMP2_INCLUDE_DIR #undef HAVE_GUILE @@ -144,3 +143,7 @@ /* Define if your have the I4B package. */ #undef HAVE_I4B #undef HAVE_I4B_ACCT + +/* Define to enable debugging. */ +#undef LIBGTOP_ENABLE_DEBUG +#undef LIBGTOP_FATAL_WARNINGS diff --git a/configure.in b/configure.in index 1f6e70e4..23ca64cd 100644 --- a/configure.in +++ b/configure.in @@ -220,7 +220,9 @@ AC_SUBST(libs_xauth) dnl For diskusage stuff GNOME_FILEUTILS_CHECKS -AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],AC_DEFINE(GNOME_ENABLE_DEBUG),) +dnl Debugging +AC_ARG_ENABLE(debug, [ --enable-debug turn on debugging [default=no]],AC_DEFINE(LIBGTOP_ENABLE_DEBUG),) +AC_ARG_ENABLE(fatal-warnings, [ --enable-fatal-warnings make all warnings fatal [debug=no]],AC_DEFINE(LIBGTOP_FATAL_WARNINGS),) LIBSUPPORT= SUPPORTINCS= diff --git a/sysdeps/common/error.c b/sysdeps/common/error.c index 6e8772b6..2ddd7dd9 100644 --- a/sysdeps/common/error.c +++ b/sysdeps/common/error.c @@ -45,7 +45,12 @@ glibtop_error_r (glibtop *server, char *format, ...) fprintf (stderr, "\n"); va_end (ap); + +#ifdef LIBGTOP_ENABLE_DEBUG + abort (); +#else exit (1); +#endif } void @@ -60,7 +65,12 @@ glibtop_error_io_r (glibtop *server, char *format, ...) fprintf (stderr, ": %s\n", strerror (errno)); va_end (ap); + +#ifdef LIBGTOP_ENABLE_DEBUG + abort (); +#else exit (1); +#endif } void @@ -75,13 +85,17 @@ glibtop_warn_r (glibtop *server, char *format, ...) fprintf (stderr, "\n"); va_end (ap); + +#ifdef LIBGTOP_FATAL_WARNINGS + abort (); +#endif } void glibtop_warn_io_r (glibtop *server, char *format, ...) { va_list ap; - + va_start (ap, format); print_server_name (server); @@ -89,4 +103,8 @@ glibtop_warn_io_r (glibtop *server, char *format, ...) fprintf (stderr, ": %s\n", strerror (errno)); va_end (ap); + +#ifdef LIBGTOP_FATAL_WARNINGS + abort (); +#endif }