diff options
author | Susant Sahani <ssahani@gmail.com> | 2015-11-24 07:08:45 +0530 |
---|---|---|
committer | Susant Sahani <ssahani@gmail.com> | 2015-11-24 07:11:01 +0530 |
commit | e28bb14a8077fa042ceb5bff84e7d000614a41c0 (patch) | |
tree | 3add9766c92bbbe9b0163cc7c4e3d66a38907cb5 /src | |
parent | e35a7876b4ab1d53a7539a905613e31dc6ae50fd (diff) |
core: mount flags remove FOREACH_WORD_SEPARATOR
FOREACH_WORD_SEPARATOR is no need here since we only
apply only one mount flag. The rvalue is sufficient for
this.
Diffstat (limited to 'src')
-rw-r--r-- | src/core/load-fragment.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index d5cf476fda..3b55781d18 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -1336,38 +1336,28 @@ int config_parse_exec_mount_flags(const char *unit, void *data, void *userdata) { - ExecContext *c = data; - const char *word, *state; - size_t l; + unsigned long flags = 0; + ExecContext *c = data; assert(filename); assert(lvalue); assert(rvalue); assert(data); - FOREACH_WORD_SEPARATOR(word, l, rvalue, ", ", state) { - _cleanup_free_ char *t; - - t = strndup(word, l); - if (!t) - return log_oom(); - - if (streq(t, "shared")) - flags = MS_SHARED; - else if (streq(t, "slave")) - flags = MS_SLAVE; - else if (streq(t, "private")) - flags = MS_PRIVATE; - else { - log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse mount flag %s, ignoring: %s", t, rvalue); - return 0; - } + if (streq(rvalue, "shared")) + flags = MS_SHARED; + else if (streq(rvalue, "slave")) + flags = MS_SLAVE; + else if (streq(rvalue, "private")) + flags = MS_PRIVATE; + else { + log_syntax(unit, LOG_ERR, filename, line, 0, "Failed to parse mount flag %s, ignoring.", rvalue); + return 0; } - if (!isempty(state)) - log_syntax(unit, LOG_ERR, filename, line, 0, "Trailing garbage, ignoring."); c->mount_flags = flags; + return 0; } |