summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-06-27 18:34:37 +0200
committerLennart Poettering <lennart@poettering.net>2014-06-27 19:35:57 +0200
commit1f97091d3cb0887c264176b47b0a86c269acf0b5 (patch)
tree2d74b97fdaa9afd31c5272a22ac31f5495fcbb89 /src
parent14cb733684d3c3f50d088a3a370ddf8e8894dfa4 (diff)
main: uid_to_name() might fail due to OOM, protect against that
Diffstat (limited to 'src')
-rw-r--r--src/core/main.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 8ee12ef8fa..38835fc620 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1547,9 +1547,10 @@ int main(int argc, char *argv[]) {
if (empty_etc)
log_info("Running with unpopulated /etc.");
} else {
- _cleanup_free_ char *t = uid_to_name(getuid());
- log_debug(PACKAGE_STRING " running in user mode for user "UID_FMT"/%s. (" SYSTEMD_FEATURES ")",
- getuid(), t);
+ _cleanup_free_ char *t;
+
+ t = uid_to_name(getuid());
+ log_debug(PACKAGE_STRING " running in user mode for user "UID_FMT"/%s. (" SYSTEMD_FEATURES ")", getuid(), strna(t));
}
if (arg_running_as == SYSTEMD_SYSTEM && !skip_setup) {