]> err.no Git - systemd/commitdiff
log: make sure generators never log into the journal to avoid activation deadlocks
authorLennart Poettering <lennart@poettering.net>
Tue, 22 May 2012 20:00:37 +0000 (22:00 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 22 May 2012 20:00:37 +0000 (22:00 +0200)
This makes all generators log to kmsg by default.

src/cryptsetup/cryptsetup-generator.c
src/fstab-generator/fstab-generator.c
src/getty-generator/getty-generator.c
src/journal/journald.c
src/rc-local-generator/rc-local-generator.c
src/shared/log.c
src/shared/log.h
src/system-update-generator/system-update-generator.c

index c0b1cf0939b5e2a13b97c3ab3b160ec18dbed7fc..7eb122d27618794ba52c4783450a26eac251c212 100644 (file)
@@ -249,7 +249,7 @@ int main(int argc, char *argv[]) {
         if (argc > 1)
                 arg_dest = argv[1];
 
-        log_set_target(LOG_TARGET_AUTO);
+        log_set_target(LOG_TARGET_SAFE);
         log_parse_environment();
         log_open();
 
index 39af18a9c8851ca8d5f81055642a291e3658cbd3..86cbc45b78d1738db2ff3b2030389e35b2fd45c3 100644 (file)
@@ -503,7 +503,7 @@ int main(int argc, char *argv[]) {
         if (argc > 1)
                 arg_dest = argv[1];
 
-        log_set_target(LOG_TARGET_AUTO);
+        log_set_target(LOG_TARGET_SAFE);
         log_parse_environment();
         log_open();
 
index 13dca7d1b0acccbe2ed8940c9d01dd888276dd5a..b2e4f52c3ca88ab55b0f051021c8d87d79632a60 100644 (file)
@@ -104,7 +104,7 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
-        log_set_target(LOG_TARGET_AUTO);
+        log_set_target(LOG_TARGET_SAFE);
         log_parse_environment();
         log_open();
 
index 232457aa5b392dfbf77fd711379aef107b953d31..c429896ac40cbd4aa9cb8530da247fe853743fbb 100644 (file)
@@ -2774,7 +2774,7 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
-        log_set_target(LOG_TARGET_KMSG);
+        log_set_target(LOG_TARGET_SAFE);
         log_set_facility(LOG_SYSLOG);
         log_parse_environment();
         log_open();
index a5987f977e0527a4dcdd54f29468129d1f06fceb..1464c8e49749876ec1fd309e9588bf60984148fe 100644 (file)
@@ -91,7 +91,7 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
-        log_set_target(LOG_TARGET_AUTO);
+        log_set_target(LOG_TARGET_SAFE);
         log_parse_environment();
         log_open();
 
index da5309888c4d4aacaa1e869ec18b1b879543db52..6a10dc4540ed288032f6fefb3ccedaf730d777a3 100644 (file)
@@ -240,7 +240,7 @@ int log_open(void) {
                 return 0;
         }
 
-        if (log_target != LOG_TARGET_AUTO ||
+        if ((log_target != LOG_TARGET_AUTO && log_target != LOG_TARGET_SAFE) ||
             getpid() == 1 ||
             isatty(STDERR_FILENO) <= 0) {
 
@@ -266,6 +266,7 @@ int log_open(void) {
                 }
 
                 if (log_target == LOG_TARGET_AUTO ||
+                    log_target == LOG_TARGET_SAFE ||
                     log_target == LOG_TARGET_JOURNAL_OR_KMSG ||
                     log_target == LOG_TARGET_SYSLOG_OR_KMSG ||
                     log_target == LOG_TARGET_KMSG) {
@@ -547,6 +548,7 @@ static int log_dispatch(
 
                 if (k <= 0 &&
                     (log_target == LOG_TARGET_AUTO ||
+                     log_target == LOG_TARGET_SAFE ||
                      log_target == LOG_TARGET_SYSLOG_OR_KMSG ||
                      log_target == LOG_TARGET_JOURNAL_OR_KMSG ||
                      log_target == LOG_TARGET_KMSG)) {
@@ -744,6 +746,7 @@ static const char *const log_target_table[] = {
         [LOG_TARGET_SYSLOG] = "syslog",
         [LOG_TARGET_SYSLOG_OR_KMSG] = "syslog-or-kmsg",
         [LOG_TARGET_AUTO] = "auto",
+        [LOG_TARGET_SAFE] = "safe",
         [LOG_TARGET_NULL] = "null"
 };
 
index b2f5f2a92060bf6a8242d908f73453e8cf819f8e..59d4c00f7d71d542944870e05da28007ee4c81d3 100644 (file)
@@ -36,6 +36,7 @@ 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
index 30fdbc3ee8cda3bfb1283493398016b94992a3cd..f4e8dafebd9bdb3986e76c7f4dccfb3ebff82ead 100644 (file)
@@ -74,7 +74,7 @@ int main(int argc, char *argv[]) {
         if (argc > 1)
                 arg_dest = argv[1];
 
-        log_set_target(LOG_TARGET_AUTO);
+        log_set_target(LOG_TARGET_SAFE);
         log_parse_environment();
         log_open();