diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-11-24 14:16:50 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-11-24 14:16:50 +0100 |
commit | e3d85eeae2eba1e4e995cb6d6e84ce295bc1704d (patch) | |
tree | 07e6964f13444ad252cb1fbdab4d6f71c0774593 /src | |
parent | 0d8fdbb53ee68396617e0751c3d9cc44487077ec (diff) | |
parent | e28bb14a8077fa042ceb5bff84e7d000614a41c0 (diff) |
Merge pull request #1976 from ssahani/word3
core: mount flags remove FOREACH_WORD_SEPARATOR
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; } |