- opts = strdup("ro");
- type = strdup("auto");
- if (!opts || !type)
- return log_oom();
-
- /* root= and roofstype= may occur more than once, the last instance should take precedence.
- * In the case of multiple rootflags= the arguments should be concatenated */
- FOREACH_WORD_QUOTED(w, l, line, state) {
- _cleanup_free_ char *word;
-
- word = strndup(w, l);
- if (!word)
- return log_oom();
-
- else if (startswith(word, "root=")) {
- free(what);
- what = fstab_node_to_udev_node(word+5);
- if (!what)
- return log_oom();
-
- } else if (startswith(word, "rootfstype=")) {
- free(type);
- type = strdup(word + 11);
- if (!type)
- return log_oom();
-
- } else if (startswith(word, "rootflags=")) {
- char *o;
-
- o = strjoin(opts, ",", word + 10, NULL);
- if (!o)
- return log_oom();
-
- free(opts);
- opts = o;
-
- } else if (streq(word, "ro") || streq(word, "rw")) {
- char *o;
-
- o = strjoin(opts, ",", word, NULL);
- if (!o)
- return log_oom();
-
- free(opts);
- opts = o;
- }
- }
-
- if (!what) {