]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/cryptsetup/cryptsetup-generator.c
Merge pull request #17154 from keszybz/crypttab-commas
[thirdparty/systemd.git] / src / cryptsetup / cryptsetup-generator.c
index 43b4b2efc6a616846b9a9a7ef4683fc51e2ebb03..cd0cedf118cb123b80bbee99841e1372c64d69c6 100644 (file)
@@ -274,7 +274,8 @@ static int create_disk(
                 const char *device,
                 const char *password,
                 const char *keydev,
-                const char *options) {
+                const char *options,
+                const char *source) {
 
         _cleanup_free_ char *n = NULL, *d = NULL, *u = NULL, *e = NULL,
                 *keydev_mount = NULL, *keyfile_timeout_value = NULL,
@@ -343,7 +344,7 @@ static int create_disk(
         if (r < 0)
                 return r;
 
-        r = generator_write_cryptsetup_unit_section(f, arg_crypttab);
+        r = generator_write_cryptsetup_unit_section(f, source);
         if (r < 0)
                 return r;
 
@@ -540,7 +541,7 @@ static int parse_proc_cmdline_item(const char *key, const char *value, void *dat
                 if (proc_cmdline_value_missing(key, value))
                         return 0;
 
-                d = get_crypto_device(startswith(value, "luks-") ? value+5 : value);
+                d = get_crypto_device(startswith(value, "luks-") ?: value);
                 if (!d)
                         return log_oom();
 
@@ -674,7 +675,7 @@ static int add_crypttab_devices(void) {
                 if (r < 0)
                         return r;
 
-                r = create_disk(name, device, keyfile, keydev, (d && d->options) ? d->options : options);
+                r = create_disk(name, device, keyfile, keydev, (d && d->options) ? d->options : options, arg_crypttab);
                 if (r < 0)
                         return r;
 
@@ -709,7 +710,8 @@ static int add_proc_cmdline_devices(void) {
                                 device,
                                 d->keyfile ?: arg_default_keyfile,
                                 d->keydev,
-                                d->options ?: arg_default_options);
+                                d->options ?: arg_default_options,
+                                "/proc/cmdline");
                 if (r < 0)
                         return r;
         }