#include "bus.h"
#include <stdio.h>
+#include <stdlib.h>
#include "activation.h"
#include "connection.h"
if (!bus_selinux_full_init ())
{
- bus_context_log (context, DBUS_SYSTEM_LOG_FATAL, "SELinux enabled but D-Bus initialization failed; check system log\n");
+ bus_context_log (context, DBUS_SYSTEM_LOG_ERROR,
+ "SELinux enabled but D-Bus initialization failed; "
+ "check system log");
+ exit (1);
}
if (!bus_apparmor_full_init (error))
init_warnings ();
if (fatal_warnings)
- severity = DBUS_SYSTEM_LOG_FATAL;
+ severity = DBUS_SYSTEM_LOG_ERROR;
va_start (args, format);
_dbus_logv (severity, format, args);
init_warnings ();
if (fatal_warnings_on_check_failed)
- severity = DBUS_SYSTEM_LOG_FATAL;
+ severity = DBUS_SYSTEM_LOG_ERROR;
va_start (args, format);
_dbus_logv (severity, format, args);
* @param severity a severity value
* @param msg a printf-style format string
* @param args arguments for the format string
- *
- * If the FATAL severity is given, this function will terminate the program
- * with an error code.
*/
void
_dbus_logv (DBusSystemLogSeverity severity,
case DBUS_SYSTEM_LOG_SECURITY:
flags = LOG_AUTH | LOG_NOTICE;
break;
- case DBUS_SYSTEM_LOG_FATAL:
+ case DBUS_SYSTEM_LOG_ERROR:
flags = LOG_DAEMON|LOG_CRIT;
break;
default:
fputc ('\n', stderr);
va_end (tmp);
}
-
- if (severity == DBUS_SYSTEM_LOG_FATAL)
- exit (1);
}
/* tests in dbus-sysdeps-util.c */
* @param severity a severity value
* @param msg a printf-style format string
* @param args arguments for the format string
- *
- * If the FATAL severity is given, this function will terminate the program
- * with an error code.
*/
void
_dbus_logv (DBusSystemLogSeverity severity,
case DBUS_SYSTEM_LOG_INFO: s = "info"; break;
case DBUS_SYSTEM_LOG_WARNING: s = "warning"; break;
case DBUS_SYSTEM_LOG_SECURITY: s = "security"; break;
- case DBUS_SYSTEM_LOG_FATAL: s = "fatal"; break;
+ case DBUS_SYSTEM_LOG_ERROR: s = "error"; break;
default: _dbus_assert_not_reached ("invalid log severity");
}
fprintf (stderr, "\n");
va_end (tmp);
}
-
- if (severity == DBUS_SYSTEM_LOG_FATAL)
- exit (1);
}
/** @} end of sysdeps-win */
DBUS_SYSTEM_LOG_INFO,
DBUS_SYSTEM_LOG_WARNING,
DBUS_SYSTEM_LOG_SECURITY,
- DBUS_SYSTEM_LOG_FATAL
+ DBUS_SYSTEM_LOG_ERROR
} DBusSystemLogSeverity;
DBUS_PRIVATE_EXPORT
#define MESSAGE "regression test for _dbus_log(): "
static void
-test_syslog_fatal (Fixture *f,
- gconstpointer data)
-{
- if (g_test_subprocess ())
- {
- _dbus_init_system_log ("test-syslog",
- DBUS_LOG_FLAGS_SYSTEM_LOG | DBUS_LOG_FLAGS_STDERR);
- _dbus_log (DBUS_SYSTEM_LOG_FATAL, MESSAGE "%d", 23);
- /* should not be reached: exit 0 so the assertion in the main process
- * will fail */
- exit (0);
- }
-
- g_test_trap_subprocess (NULL, 0, 0);
- g_test_trap_assert_failed ();
- g_test_trap_assert_stderr ("*" MESSAGE "23\n*");
-}
-
-static void
test_syslog_normal (Fixture *f,
gconstpointer data)
{
_dbus_log (DBUS_SYSTEM_LOG_INFO, MESSAGE "%d", 42);
_dbus_log (DBUS_SYSTEM_LOG_WARNING, MESSAGE "%d", 45);
_dbus_log (DBUS_SYSTEM_LOG_SECURITY, MESSAGE "%d", 666);
+ _dbus_log (DBUS_SYSTEM_LOG_ERROR, MESSAGE "%d", 23);
_dbus_init_system_log ("test-syslog-stderr", DBUS_LOG_FLAGS_STDERR);
_dbus_log (DBUS_SYSTEM_LOG_INFO,
g_test_trap_assert_stderr ("*" MESSAGE "42\n"
"*" MESSAGE "45\n"
"*" MESSAGE "666\n"
+ "*" MESSAGE "23\n"
"*test-syslog-stderr*" MESSAGE
"this should not appear in the syslog\n"
"*test-syslog-both*" MESSAGE
{
test_init (&argc, &argv);
- g_test_add ("/syslog/fatal", Fixture, NULL, setup, test_syslog_fatal,
- teardown);
g_test_add ("/syslog/normal", Fixture, NULL, setup, test_syslog_normal,
teardown);