summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-07-21 20:22:42 +0200
committerLennart Poettering <lennart@poettering.net>2016-07-22 12:59:36 +0200
commite042eab7200b0c96c19f80100e3624bdba653a92 (patch)
tree42e257fc3017b5aefd43ecf9b99571caa4a8c04a
parent15b1248a6b63448c2081fb2ed433f83b32febe47 (diff)
main: make sure set_machine_id() doesn't clobber arg_machine_id on failure
-rw-r--r--src/core/main.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/core/main.c b/src/core/main.c
index fc04fb8051..fa02455c4a 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -291,14 +291,16 @@ static int parse_crash_chvt(const char *value) {
}
static int set_machine_id(const char *m) {
+ sd_id128_t t;
assert(m);
- if (sd_id128_from_string(m, &arg_machine_id) < 0)
+ if (sd_id128_from_string(m, &t) < 0)
return -EINVAL;
- if (sd_id128_is_null(arg_machine_id))
+ if (sd_id128_is_null(t))
return -EINVAL;
+ arg_machine_id = t;
return 0;
}