summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-12-03 13:57:42 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-12-17 13:57:04 -0500
commitc73838280cb107a10e0d8d45227d5471db56368f (patch)
treef8e57c6d966b36f9ae8bc5301d36f3c27869ae3c /src/core
parent117d5a27a3480fd9729cfadd98d135d21732a88d (diff)
Modify mount_propagation_flags_from_string to return a normal int code
This means that callers can distiguish an error from flags==0, and don't have to special-case the empty string.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/dbus-execute.c2
-rw-r--r--src/core/load-fragment.c16
2 files changed, 5 insertions, 13 deletions
diff --git a/src/core/dbus-execute.c b/src/core/dbus-execute.c
index b3fc0ff5c3..9960b7a811 100644
--- a/src/core/dbus-execute.c
+++ b/src/core/dbus-execute.c
@@ -1671,7 +1671,7 @@ int bus_exec_context_set_transient_property(
if (mode != UNIT_CHECK) {
c->mount_flags = flags;
- unit_write_drop_in_private_format(u, mode, name, "%s=%s", name, strempty(mount_propagation_flags_to_string(flags)));
+ unit_write_drop_in_private_format(u, mode, name, "%s=%s", name, mount_propagation_flags_to_string(flags));
}
return 1;
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c
index f325d853c6..bc0cf73d39 100644
--- a/src/core/load-fragment.c
+++ b/src/core/load-fragment.c
@@ -1278,25 +1278,17 @@ int config_parse_exec_mount_flags(
void *userdata) {
- unsigned long flags;
ExecContext *c = data;
+ int r;
assert(filename);
assert(lvalue);
assert(rvalue);
assert(data);
- if (isempty(rvalue))
- flags = 0;
- else {
- flags = mount_propagation_flags_from_string(rvalue);
- if (flags == 0) {
- log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse mount flag %s, ignoring.", rvalue);
- return 0;
- }
- }
-
- c->mount_flags = flags;
+ r = mount_propagation_flags_from_string(rvalue, &c->mount_flags);
+ if (r < 0)
+ log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse mount flag %s, ignoring.", rvalue);
return 0;
}