summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-09-23 05:33:33 +0200
committerLennart Poettering <lennart@poettering.net>2011-09-23 16:28:27 +0200
commit799f46d36f1c1f5ce8f638f453feeede3e6842fc (patch)
tree2599704471f71b49c540962825ae5c0dc05fab6a /src/util.c
parent65bc2c21140d20e757b0aed9bb23286939426abb (diff)
util: don't fail if no id was passed to detect_container()
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c
index 33b6fd4809..ed3b8d421a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -4445,17 +4445,23 @@ int detect_container(const char **id) {
if (streq(line, "container=lxc")) {
fclose(f);
- *id = "lxc";
+
+ if (id)
+ *id = "lxc";
return 1;
} else if (streq(line, "container=systemd-nspawn")) {
fclose(f);
- *id = "systemd-nspawn";
+
+ if (id)
+ *id = "systemd-nspawn";
return 1;
} else if (startswith(line, "container=")) {
fclose(f);
- *id = "other-container";
+
+ if (id)
+ *id = "other-container";
return 1;
}