]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fstab-generator: port some code to strextend_with_separator() 7494/head
authorLennart Poettering <lennart@poettering.net>
Tue, 28 Nov 2017 19:11:52 +0000 (20:11 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 5 Dec 2017 12:49:13 +0000 (13:49 +0100)
src/fstab-generator/fstab-generator.c

index 68e7c23cbea9cb9a593cd0a11006ebe67ec3f4c5..c0886547e08d5e636fb1b530b4a792d4f3add450 100644 (file)
@@ -820,19 +820,13 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
                         return log_oom();
 
         } else if (streq(key, "rootflags")) {
-                char *o;
 
                 if (proc_cmdline_value_missing(key, value))
                         return 0;
 
-                o = arg_root_options ?
-                        strjoin(arg_root_options, ",", value) :
-                        strdup(value);
-                if (!o)
+                if (!strextend_with_separator(&arg_root_options, ",", value, NULL))
                         return log_oom();
 
-                free(arg_root_options);
-                arg_root_options = o;
         } else if (streq(key, "roothash")) {
 
                 if (proc_cmdline_value_missing(key, value))
@@ -858,20 +852,13 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
                         return log_oom();
 
         } else if (streq(key, "mount.usrflags")) {
-                char *o;
 
                 if (proc_cmdline_value_missing(key, value))
                         return 0;
 
-                o = arg_usr_options ?
-                        strjoin(arg_usr_options, ",", value) :
-                        strdup(value);
-                if (!o)
+                if (!strextend_with_separator(&arg_usr_options, ",", value, NULL))
                         return log_oom();
 
-                free(arg_usr_options);
-                arg_usr_options = o;
-
         } else if (streq(key, "rw") && !value)
                 arg_root_rw = true;
         else if (streq(key, "ro") && !value)