-/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
-
/***
This file is part of systemd.
static bool show_color = false;
static bool show_location = false;
-/// UNNEEDED by elogind static bool upgrade_syslog_to_journal = false;
+#if 0 /// UNNEEDED by elogind
+static bool upgrade_syslog_to_journal = false;
+#endif // 0
/* Akin to glibc's __abort_msg; which is private and we hence cannot
* use here. */
goto fail;
}
- if (connect(syslog_fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0) {
+ if (connect(syslog_fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0) {
safe_close(syslog_fd);
/* Some legacy syslog systems still use stream
goto fail;
}
- if (connect(syslog_fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0) {
+ if (connect(syslog_fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0) {
r = -errno;
goto fail;
}
return r;
}
-#if 0 /// UNNEEDED by elogind
void log_close_journal(void) {
+#if 0 /// elogind does not support journald
journal_fd = safe_close(journal_fd);
+#endif // 0
}
+#if 0 /// UNNEEDED by elogind
static int log_open_journal(void) {
static const union sockaddr_union sa = {
goto fail;
}
- if (connect(journal_fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0) {
+ if (connect(journal_fd, &sa.sa, SOCKADDR_UN_LEN(sa.un)) < 0) {
r = -errno;
goto fail;
}
* because there is no reason to close it. */
if (log_target == LOG_TARGET_NULL) {
- /// UNNEEDED by elogind log_close_journal();
+ log_close_journal();
log_close_syslog();
log_close_console();
return 0;
}
}
#endif // 0
+
if (log_target == LOG_TARGET_SYSLOG_OR_KMSG ||
log_target == LOG_TARGET_SYSLOG) {
r = log_open_syslog();
if (r >= 0) {
- /// UNNEEDED by elogind log_close_journal();
+ log_close_journal();
log_close_console();
return r;
}
if (log_target == LOG_TARGET_AUTO ||
log_target == LOG_TARGET_SAFE ||
- /// UNNEEDED by elogind log_target == LOG_TARGET_JOURNAL_OR_KMSG ||
+ log_target == LOG_TARGET_JOURNAL_OR_KMSG ||
log_target == LOG_TARGET_SYSLOG_OR_KMSG ||
log_target == LOG_TARGET_KMSG) {
r = log_open_kmsg();
if (r >= 0) {
- /// UNNEEDED by elogind log_close_journal();
+ log_close_journal();
log_close_syslog();
log_close_console();
return r;
}
}
- /// UNNEEDED by elogind log_close_journal();
+ log_close_journal();
log_close_syslog();
return log_open_console();
}
void log_close(void) {
- /// UNNEDED by elogind log_close_journal();
+ log_close_journal();
log_close_syslog();
log_close_kmsg();
log_close_console();
const char *object,
const char *buffer) {
- char location[64], prefix[1 + DECIMAL_STR_MAX(int) + 2];
+ char location[256], prefix[1 + DECIMAL_STR_MAX(int) + 2];
struct iovec iovec[6] = {};
unsigned n = 0;
bool highlight;
(log_target == LOG_TARGET_AUTO ||
log_target == LOG_TARGET_SAFE ||
log_target == LOG_TARGET_SYSLOG_OR_KMSG ||
- /// UNNEEDED by elogind log_target == LOG_TARGET_JOURNAL_OR_KMSG ||
+ log_target == LOG_TARGET_JOURNAL_OR_KMSG ||
log_target == LOG_TARGET_KMSG)) {
k = write_to_kmsg(level, error, file, line, func, object_field, object, buffer);
return;
DISABLE_WARNING_FORMAT_NONLITERAL;
- snprintf(buffer, sizeof(buffer), format, text, file, line, func);
+ xsprintf(buffer, format, text, file, line, func);
REENABLE_WARNING;
log_abort_msg = buffer;