summaryrefslogtreecommitdiffstats
path: root/src/cryptsetup
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2020-09-09 17:43:38 +0200
committerGitHub <noreply@github.com>2020-09-09 17:43:38 +0200
commit12ce0f41735e3d179c41deee99d9abe8aae52527 (patch)
tree13ba019fd7e4232da90de24f9ee36f6a669b4833 /src/cryptsetup
parentMerge pull request #16972 from wusto/ambient-and-keep-caps-corrections (diff)
parentRename strv_split_extract() to strv_split_full() (diff)
downloadsystemd-12ce0f41735e3d179c41deee99d9abe8aae52527.tar.xz
systemd-12ce0f41735e3d179c41deee99d9abe8aae52527.zip
Merge pull request #16635 from keszybz/do-not-for-each-word
Drop FOREACH_WORD
Diffstat (limited to 'src/cryptsetup')
-rw-r--r--src/cryptsetup/cryptsetup.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index f9e627da46..7d0571f147 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -288,19 +288,19 @@ static int parse_one_option(const char *option) {
}
static int parse_options(const char *options) {
- const char *word, *state;
- size_t l;
- int r;
-
assert(options);
- FOREACH_WORD_SEPARATOR(word, l, options, ",", state) {
- _cleanup_free_ char *o;
+ for (;;) {
+ _cleanup_free_ char *word = NULL;
+ int r;
+
+ r = extract_first_word(&options, &word, ",", EXTRACT_DONT_COALESCE_SEPARATORS);
+ if (r < 0)
+ return log_debug_errno(r, "Failed to parse options: %m");
+ if (r == 0)
+ break;
- o = strndup(word, l);
- if (!o)
- return -ENOMEM;
- r = parse_one_option(o);
+ r = parse_one_option(word);
if (r < 0)
return r;
}