]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
main: do bother with uid_to_name() unless we do debug logging
authorLennart Poettering <lennart@poettering.net>
Fri, 15 Dec 2017 17:51:54 +0000 (18:51 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 15 Dec 2017 19:52:28 +0000 (20:52 +0100)
src/core/main.c

index 28621ae38bb4e144153319d4470c268b82ac1c26..ab9f3db27672eac6f8f1e1c87fa36bf46363158c 100644 (file)
@@ -1889,11 +1889,13 @@ static void log_execution_mode(bool *ret_first_boot) {
                                 log_info("Running with unpopulated /etc.");
                 }
         } else {
-                _cleanup_free_ char *t;
+                if (DEBUG_LOGGING) {
+                        _cleanup_free_ char *t;
 
-                t = uid_to_name(getuid());
-                log_debug(PACKAGE_STRING " running in %suser mode for user " UID_FMT "/%s. (" SYSTEMD_FEATURES ")",
-                          arg_action == ACTION_TEST ? " test" : "", getuid(), strna(t));
+                        t = uid_to_name(getuid());
+                        log_debug(PACKAGE_STRING " running in %suser mode for user " UID_FMT "/%s. (" SYSTEMD_FEATURES ")",
+                                  arg_action == ACTION_TEST ? " test" : "", getuid(), strna(t));
+                }
 
                 *ret_first_boot = false;
         }