[systemd-commits] 2 commits - TODO src/bridge.c src/journal src/log.c src/log.h src/login
Lennart Poettering
lennart at kemper.freedesktop.org
Tue Apr 3 10:26:54 PDT 2012
TODO | 2 --
src/bridge.c | 2 +-
src/journal/journald.c | 1 +
src/log.c | 13 ++++++++++---
src/log.h | 1 +
src/login/logind.c | 1 +
6 files changed, 14 insertions(+), 6 deletions(-)
New commits:
commit 3eff4208ffecedd778fec260f0d4b18e94dab443
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Apr 3 19:25:29 2012 +0200
logind: log with AUTH facility
diff --git a/TODO b/TODO
index 6f7679f..4f3b157 100644
--- a/TODO
+++ b/TODO
@@ -30,8 +30,6 @@ Features:
* dbus upstream still refers to dbus.target and shouldn't
-* ensure that logind sets the syslog facility to AUTH when logging
-
* when a service has the same env var set twice we actually store it twice and return that in systemctl show -p... We should only show the last setting
* add man page documenting all kernel cmdline options, including stuff like fsck.mode=
diff --git a/src/journal/journald.c b/src/journal/journald.c
index f341b87..555d74f 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -2765,6 +2765,7 @@ int main(int argc, char *argv[]) {
}
log_set_target(LOG_TARGET_CONSOLE);
+ log_set_facility(LOG_SYSLOG);
log_parse_environment();
log_open();
diff --git a/src/log.c b/src/log.c
index 5b17211..9fffc1d 100644
--- a/src/log.c
+++ b/src/log.c
@@ -37,6 +37,7 @@
static LogTarget log_target = LOG_TARGET_CONSOLE;
static int log_max_level = LOG_INFO;
+static int log_facility = LOG_DAEMON;
static int console_fd = STDERR_FILENO;
static int syslog_fd = -1;
@@ -310,6 +311,10 @@ void log_set_max_level(int level) {
log_max_level = level;
}
+void log_set_facility(int facility) {
+ log_facility = facility;
+}
+
static int write_to_console(
int level,
const char*file,
@@ -457,11 +462,13 @@ static int write_to_journal(
snprintf(header, sizeof(header),
"PRIORITY=%i\n"
+ "SYSLOG_FACILITY=%i\n"
"CODE_FILE=%s\n"
"CODE_LINE=%i\n"
"CODE_FUNCTION=%s\n"
"MESSAGE=",
LOG_PRI(level),
+ LOG_FAC(level),
file,
line,
func);
@@ -497,7 +504,7 @@ static int log_dispatch(
/* Patch in LOG_DAEMON facility if necessary */
if ((level & LOG_FACMASK) == 0)
- level = LOG_DAEMON | LOG_PRI(level);
+ level = log_facility | LOG_PRI(level);
do {
char *e;
diff --git a/src/log.h b/src/log.h
index 5c6310e..3283808 100644
--- a/src/log.h
+++ b/src/log.h
@@ -43,6 +43,7 @@ typedef enum LogTarget{
void log_set_target(LogTarget target);
void log_set_max_level(int level);
+void log_set_facility(int facility);
int log_set_target_from_string(const char *e);
int log_set_max_level_from_string(const char *e);
diff --git a/src/login/logind.c b/src/login/logind.c
index 777d912..a54195c 100644
--- a/src/login/logind.c
+++ b/src/login/logind.c
@@ -1240,6 +1240,7 @@ int main(int argc, char *argv[]) {
int r;
log_set_target(LOG_TARGET_AUTO);
+ log_set_facility(LOG_AUTH);
log_parse_environment();
log_open();
commit 3338b9595b69a4a6de43bbd0f49b941eba7f6b0e
Author: Lennart Poettering <lennart at poettering.net>
Date: Tue Apr 3 19:24:12 2012 +0200
fix a couple of AF_UNIX connect() calls
diff --git a/src/bridge.c b/src/bridge.c
index 1f7cf3a..bfb38a8 100644
--- a/src/bridge.c
+++ b/src/bridge.c
@@ -160,7 +160,7 @@ int main(int argc, char *argv[]) {
sa.un.sun_family = AF_UNIX;
strncpy(sa.un.sun_path, "/run/dbus/system_bus_socket", sizeof(sa.un.sun_path));
- if (connect(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + 1 + strlen(sa.un.sun_path+1)) < 0) {
+ if (connect(fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0) {
log_error("Failed to connect: %m");
goto finish;
}
diff --git a/src/log.c b/src/log.c
index 9499367..5b17211 100644
--- a/src/log.c
+++ b/src/log.c
@@ -151,7 +151,7 @@ static int log_open_syslog(void) {
goto fail;
}
- if (connect(syslog_fd, &sa.sa, sizeof(sa)) < 0) {
+ if (connect(syslog_fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0) {
close_nointr_nofail(syslog_fd);
/* Some legacy syslog systems still use stream
@@ -163,7 +163,7 @@ static int log_open_syslog(void) {
goto fail;
}
- if (connect(syslog_fd, &sa.sa, sizeof(sa)) < 0) {
+ if (connect(syslog_fd, &sa.sa, offsetof(struct sockaddr_un, sun_path) + strlen(sa.un.sun_path)) < 0) {
r = -errno;
goto fail;
}
More information about the systemd-commits
mailing list