summaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authorRonny Chevalier <chevalier.ronny@gmail.com>2016-08-05 13:35:52 +0200
committerGitHub <noreply@github.com>2016-08-05 13:35:52 +0200
commit96533edceb5bb626a674acda2843de72838811cf (patch)
tree58d255848f99af24009cea575d4d58ec53d6874d /src/shared
parent1ed1f50f8277df07918e13cba3331a114eaa6fe3 (diff)
parent41bf0590cc89438f1d319465190b1c00809c78fe (diff)
Merge pull request #3902 from poettering/parse-nice
util-lib: unify parsing of nice level values
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/bus-unit-util.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c
index 589f9d46e9..c3a5233532 100644
--- a/src/shared/bus-unit-util.c
+++ b/src/shared/bus-unit-util.c
@@ -366,15 +366,13 @@ int bus_append_unit_property_assignment(sd_bus_message *m, const char *assignmen
}
} else if (streq(field, "Nice")) {
- int32_t i;
+ int n;
- r = safe_atoi32(eq, &i);
- if (r < 0) {
- log_error("Failed to parse %s value %s.", field, eq);
- return -EINVAL;
- }
+ r = parse_nice(eq, &n);
+ if (r < 0)
+ return log_error_errno(r, "Failed to parse nice value: %s", eq);
- r = sd_bus_message_append(m, "v", "i", i);
+ r = sd_bus_message_append(m, "v", "i", (int32_t) n);
} else if (STR_IN_SET(field, "Environment", "PassEnvironment")) {
const char *p;