[systemd-commits] 2 commits - src/core src/shared

Lennart Poettering lennart at kemper.freedesktop.org
Mon Feb 17 16:23:43 CET 2014


 src/core/main.c          |   36 ++++++++++++++++++++++++++----------
 src/shared/exit-status.h |    2 +-
 src/shared/util.c        |   18 ------------------
 src/shared/util.h        |    1 -
 4 files changed, 27 insertions(+), 30 deletions(-)

New commits:
commit 15bd5aee092572116886f0f9381f3477f48241fb
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Feb 17 16:18:17 2014 +0100

    main: make gcc shut up

diff --git a/src/core/main.c b/src/core/main.c
index 3c1e04c..7566b0a 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1911,9 +1911,9 @@ finish:
                         "--log-target",
                 };
                 unsigned pos = 5;
-                assert(command_line[pos] == NULL);
-
                 _cleanup_strv_free_ char **env_block = NULL;
+
+                assert(command_line[pos] == NULL);
                 env_block = strv_copy(environ);
 
                 snprintf(log_level, sizeof(log_level), "%d", log_get_max_level());

commit b6e2f3293d0f9a821819d96038eec2a19062151f
Author: Lennart Poettering <lennart at poettering.net>
Date:   Mon Feb 17 16:17:08 2014 +0100

    core: fixate show_status earlier, so that we actually print the welcome message
    
    Previously, we'd fixed show_state only after printing the welcome
    message which had the effect that the welcome message was almost always
    suppressed.

diff --git a/src/core/main.c b/src/core/main.c
index b5bb3f6..3c1e04c 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -88,7 +88,7 @@ static bool arg_dump_core = true;
 static bool arg_crash_shell = false;
 static int arg_crash_chvt = -1;
 static bool arg_confirm_spawn = false;
-static ShowStatus arg_show_status = SHOW_STATUS_UNSET;
+static ShowStatus arg_show_status = _SHOW_STATUS_UNSET;
 static bool arg_switched_root = false;
 static char ***arg_join_controllers = NULL;
 static ExecOutput arg_default_std_output = EXEC_OUTPUT_JOURNAL;
@@ -408,7 +408,7 @@ static int parse_proc_cmdline_word(const char *word) {
                 }
 
         } else if (streq(word, "quiet")) {
-                if (arg_show_status == SHOW_STATUS_UNSET)
+                if (arg_show_status == _SHOW_STATUS_UNSET)
                         arg_show_status = SHOW_STATUS_AUTO;
         } else if (streq(word, "debug")) {
                 /* Log to kmsg, the journal socket will fill up before the
@@ -1209,6 +1209,24 @@ finish:
 #endif
 }
 
+static int status_welcome(void) {
+        _cleanup_free_ char *pretty_name = NULL, *ansi_color = NULL;
+        int r;
+
+        r = parse_env_file("/etc/os-release", NEWLINE,
+                           "PRETTY_NAME", &pretty_name,
+                           "ANSI_COLOR", &ansi_color,
+                           NULL);
+
+        if (r < 0 && r != -ENOENT)
+                log_warning("Failed to read /etc/os-release: %s", strerror(-r));
+
+        return status_printf(NULL, false, false,
+                             "\nWelcome to \x1B[%sm%s\x1B[0m!\n",
+                             isempty(ansi_color) ? "1" : ansi_color,
+                             isempty(pretty_name) ? "Linux" : pretty_name);
+}
+
 int main(int argc, char *argv[]) {
         Manager *m = NULL;
         int r, retval = EXIT_FAILURE;
@@ -1470,6 +1488,9 @@ int main(int argc, char *argv[]) {
         /* Open the logging devices, if possible and necessary */
         log_open();
 
+        if (arg_show_status == _SHOW_STATUS_UNSET)
+                arg_show_status = SHOW_STATUS_YES;
+
         /* Make sure we leave a core dump without panicing the
          * kernel. */
         if (getpid() == 1) {
@@ -1576,12 +1597,7 @@ int main(int argc, char *argv[]) {
         m->security_finish_timestamp = security_finish_timestamp;
 
         manager_set_default_rlimits(m, arg_default_rlimit);
-
-        if (arg_default_environment)
-                manager_environment_add(m, NULL, arg_default_environment);
-
-        if (arg_show_status == SHOW_STATUS_UNSET)
-                arg_show_status = SHOW_STATUS_YES;
+        manager_environment_add(m, NULL, arg_default_environment);
         manager_set_show_status(m, arg_show_status);
 
         /* Remember whether we should queue the default job */
diff --git a/src/shared/exit-status.h b/src/shared/exit-status.h
index e84bfe3..8f9bddf 100644
--- a/src/shared/exit-status.h
+++ b/src/shared/exit-status.h
@@ -91,7 +91,7 @@ bool is_clean_exit_lsb(int code, int status, ExitStatusSet *success_status);
 /* Manager status */
 
 typedef enum ShowStatus {
-        SHOW_STATUS_UNSET = -2,
+        _SHOW_STATUS_UNSET = -2,
         SHOW_STATUS_AUTO = -1,
         SHOW_STATUS_NO = 0,
         SHOW_STATUS_YES = 1,
diff --git a/src/shared/util.c b/src/shared/util.c
index d95a4b4..4f3145b 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -2928,24 +2928,6 @@ int status_printf(const char *status, bool ellipse, bool ephemeral, const char *
         return r;
 }
 
-int status_welcome(void) {
-        _cleanup_free_ char *pretty_name = NULL, *ansi_color = NULL;
-        int r;
-
-        r = parse_env_file("/etc/os-release", NEWLINE,
-                           "PRETTY_NAME", &pretty_name,
-                           "ANSI_COLOR", &ansi_color,
-                           NULL);
-
-        if (r < 0 && r != -ENOENT)
-                log_warning("Failed to read /etc/os-release: %s", strerror(-r));
-
-        return status_printf(NULL, false, false,
-                             "\nWelcome to \x1B[%sm%s\x1B[0m!\n",
-                             isempty(ansi_color) ? "1" : ansi_color,
-                             isempty(pretty_name) ? "Linux" : pretty_name);
-}
-
 char *replace_env(const char *format, char **env) {
         enum {
                 WORD,
diff --git a/src/shared/util.h b/src/shared/util.h
index 4bed5b4..7c88dad 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -409,7 +409,6 @@ cpu_set_t* cpu_set_malloc(unsigned *ncpus);
 
 int status_vprintf(const char *status, bool ellipse, bool ephemeral, const char *format, va_list ap) _printf_(4,0);
 int status_printf(const char *status, bool ellipse, bool ephemeral, const char *format, ...) _printf_(4,5);
-int status_welcome(void);
 
 int fd_columns(int fd);
 unsigned columns(void);



More information about the systemd-commits mailing list