summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-01-24 18:01:01 +0100
committerLennart Poettering <lennart@poettering.net>2018-01-24 18:22:56 +0100
commit6c347d5024e7451336d0c5d0f7eaf90ae11d9dc9 (patch)
tree573979425305a2f337aff8f96e91eb3c42228641 /src
parent7a3be263d2ac9ecb17072c956789c4882c230f1e (diff)
downloadsystemd-6c347d5024e7451336d0c5d0f7eaf90ae11d9dc9.tar.gz
log: remove LOG_TARGET_SAFE pseudo log target
This removes LOG_TARGET_SAFE. It's made redundant by the new "prohibit-ipc" logging flag, as it used to have a similar effect: avoid logging to the journal/syslog, i.e. any local services in order to avoid deadlocks when we lock from PID 1 or its utility processes (such as generators). All previous users of LOG_TARGET_SAFE are switched over to the new setting. This makes things a bit safer for all, as not even the SYSTEMD_LOG_TARGET env var can be used to accidentally log to the journal anymore in these programs.
Diffstat (limited to 'src')
-rw-r--r--src/basic/log.c7
-rw-r--r--src/basic/log.h1
-rw-r--r--src/cryptsetup/cryptsetup-generator.c3
-rw-r--r--src/debug-generator/debug-generator.c3
-rw-r--r--src/fstab-generator/fstab-generator.c3
-rw-r--r--src/getty-generator/getty-generator.c3
-rw-r--r--src/gpt-auto-generator/gpt-auto-generator.c3
-rw-r--r--src/hibernate-resume/hibernate-resume-generator.c3
-rw-r--r--src/journal/journald.c3
-rw-r--r--src/rc-local-generator/rc-local-generator.c3
-rw-r--r--src/system-update-generator/system-update-generator.c3
-rw-r--r--src/sysv-generator/sysv-generator.c3
-rw-r--r--src/veritysetup/veritysetup-generator.c3
13 files changed, 24 insertions, 17 deletions
diff --git a/src/basic/log.c b/src/basic/log.c
index ae0ac72b57..2b15ecba84 100644
--- a/src/basic/log.c
+++ b/src/basic/log.c
@@ -251,7 +251,7 @@ int log_open(void) {
return 0;
}
- if (!IN_SET(log_target, LOG_TARGET_AUTO, LOG_TARGET_SAFE) ||
+ if (log_target != LOG_TARGET_AUTO ||
getpid_cached() == 1 ||
isatty(STDERR_FILENO) <= 0) {
@@ -279,7 +279,6 @@ int log_open(void) {
}
if (IN_SET(log_target, LOG_TARGET_AUTO,
- LOG_TARGET_SAFE,
LOG_TARGET_JOURNAL_OR_KMSG,
LOG_TARGET_SYSLOG_OR_KMSG,
LOG_TARGET_KMSG)) {
@@ -631,7 +630,6 @@ int log_dispatch_internal(
if (k <= 0 &&
IN_SET(log_target, LOG_TARGET_AUTO,
- LOG_TARGET_SAFE,
LOG_TARGET_SYSLOG_OR_KMSG,
LOG_TARGET_JOURNAL_OR_KMSG,
LOG_TARGET_KMSG)) {
@@ -1223,8 +1221,7 @@ static const char *const log_target_table[_LOG_TARGET_MAX] = {
[LOG_TARGET_SYSLOG] = "syslog",
[LOG_TARGET_SYSLOG_OR_KMSG] = "syslog-or-kmsg",
[LOG_TARGET_AUTO] = "auto",
- [LOG_TARGET_SAFE] = "safe",
- [LOG_TARGET_NULL] = "null"
+ [LOG_TARGET_NULL] = "null",
};
DEFINE_STRING_TABLE_LOOKUP(log_target, LogTarget);
diff --git a/src/basic/log.h b/src/basic/log.h
index cc767ba1a9..f2c6cd8c0a 100644
--- a/src/basic/log.h
+++ b/src/basic/log.h
@@ -50,7 +50,6 @@ typedef enum LogTarget{
LOG_TARGET_SYSLOG,
LOG_TARGET_SYSLOG_OR_KMSG,
LOG_TARGET_AUTO, /* console if stderr is tty, JOURNAL_OR_KMSG otherwise */
- LOG_TARGET_SAFE, /* console if stderr is tty, KMSG otherwise */
LOG_TARGET_NULL,
_LOG_TARGET_MAX,
_LOG_TARGET_INVALID = -1
diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c
index 0b46e2db2a..acde2a6a32 100644
--- a/src/cryptsetup/cryptsetup-generator.c
+++ b/src/cryptsetup/cryptsetup-generator.c
@@ -472,7 +472,8 @@ int main(int argc, char *argv[]) {
if (argc > 1)
arg_dest = argv[1];
- log_set_target(LOG_TARGET_SAFE);
+ log_set_prohibit_ipc(true);
+ log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
diff --git a/src/debug-generator/debug-generator.c b/src/debug-generator/debug-generator.c
index 604faa0d18..61c890d05a 100644
--- a/src/debug-generator/debug-generator.c
+++ b/src/debug-generator/debug-generator.c
@@ -165,7 +165,8 @@ int main(int argc, char *argv[]) {
if (argc > 1)
arg_dest = argv[2];
- log_set_target(LOG_TARGET_SAFE);
+ log_set_prohibit_ipc(true);
+ log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index 95bc5e38d5..f392f89099 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -891,7 +891,8 @@ int main(int argc, char *argv[]) {
if (argc > 3)
arg_dest_late = argv[3];
- log_set_target(LOG_TARGET_SAFE);
+ log_set_prohibit_ipc(true);
+ log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
diff --git a/src/getty-generator/getty-generator.c b/src/getty-generator/getty-generator.c
index 3f62a81abc..f475aef66c 100644
--- a/src/getty-generator/getty-generator.c
+++ b/src/getty-generator/getty-generator.c
@@ -138,7 +138,8 @@ int main(int argc, char *argv[]) {
if (argc > 1)
arg_dest = argv[1];
- log_set_target(LOG_TARGET_SAFE);
+ log_set_prohibit_ipc(true);
+ log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
diff --git a/src/gpt-auto-generator/gpt-auto-generator.c b/src/gpt-auto-generator/gpt-auto-generator.c
index 85899ab301..cbdbc5afe2 100644
--- a/src/gpt-auto-generator/gpt-auto-generator.c
+++ b/src/gpt-auto-generator/gpt-auto-generator.c
@@ -713,7 +713,8 @@ int main(int argc, char *argv[]) {
if (argc > 1)
arg_dest = argv[3];
- log_set_target(LOG_TARGET_SAFE);
+ log_set_prohibit_ipc(true);
+ log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
diff --git a/src/hibernate-resume/hibernate-resume-generator.c b/src/hibernate-resume/hibernate-resume-generator.c
index 01222db516..a81386ef63 100644
--- a/src/hibernate-resume/hibernate-resume-generator.c
+++ b/src/hibernate-resume/hibernate-resume-generator.c
@@ -86,7 +86,8 @@ int main(int argc, char *argv[]) {
if (argc > 1)
arg_dest = argv[1];
- log_set_target(LOG_TARGET_SAFE);
+ log_set_prohibit_ipc(true);
+ log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 2724a2df95..10a6955769 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -40,7 +40,8 @@ int main(int argc, char *argv[]) {
return EXIT_FAILURE;
}
- log_set_target(LOG_TARGET_SAFE);
+ log_set_prohibit_ipc(true);
+ log_set_target(LOG_TARGET_AUTO);
log_set_facility(LOG_SYSLOG);
log_parse_environment();
log_open();
diff --git a/src/rc-local-generator/rc-local-generator.c b/src/rc-local-generator/rc-local-generator.c
index b10b18eb8e..2762fa7e89 100644
--- a/src/rc-local-generator/rc-local-generator.c
+++ b/src/rc-local-generator/rc-local-generator.c
@@ -64,7 +64,8 @@ int main(int argc, char *argv[]) {
if (argc > 1)
arg_dest = argv[1];
- log_set_target(LOG_TARGET_SAFE);
+ log_set_prohibit_ipc(true);
+ log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
diff --git a/src/system-update-generator/system-update-generator.c b/src/system-update-generator/system-update-generator.c
index 1796bae340..ec05e7b9e6 100644
--- a/src/system-update-generator/system-update-generator.c
+++ b/src/system-update-generator/system-update-generator.c
@@ -79,7 +79,8 @@ int main(int argc, char *argv[]) {
if (argc > 1)
arg_dest = argv[2];
- log_set_target(LOG_TARGET_SAFE);
+ log_set_prohibit_ipc(true);
+ log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 51306b5625..087ba08559 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -950,7 +950,8 @@ int main(int argc, char *argv[]) {
if (argc > 1)
arg_dest = argv[3];
- log_set_target(LOG_TARGET_SAFE);
+ log_set_prohibit_ipc(true);
+ log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();
diff --git a/src/veritysetup/veritysetup-generator.c b/src/veritysetup/veritysetup-generator.c
index 24bee41243..d09f295392 100644
--- a/src/veritysetup/veritysetup-generator.c
+++ b/src/veritysetup/veritysetup-generator.c
@@ -228,7 +228,8 @@ int main(int argc, char *argv[]) {
if (argc > 1)
arg_dest = argv[1];
- log_set_target(LOG_TARGET_SAFE);
+ log_set_prohibit_ipc(true);
+ log_set_target(LOG_TARGET_AUTO);
log_parse_environment();
log_open();