shared/fstab-util: teach fstab_filter_options() a mode where all values are returned

Apart from tests, the new argument isn't used anywhere, so there should be no
functional change. Note that the two arms of the big conditional are switched, so the
diff is artificially inflated. The actual code change is rather small. I dropped the
path which extracts ret_value manually, because it wasn't supporting unescaping of the
escape character properly.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2021-03-11 11:25:15 +01:00
parent 0264b404b9
commit ff0c31bc27
7 changed files with 164 additions and 116 deletions
+6 -3
View File
@@ -301,7 +301,9 @@ static int create_disk(
netdev = fstab_test_option(options, "_netdev\0");
attach_in_initrd = fstab_test_option(options, "x-initrd.attach\0");
keyfile_can_timeout = fstab_filter_options(options, "keyfile-timeout\0", NULL, &keyfile_timeout_value, NULL);
keyfile_can_timeout = fstab_filter_options(options,
"keyfile-timeout\0",
NULL, &keyfile_timeout_value, NULL, NULL);
if (keyfile_can_timeout < 0)
return log_error_errno(keyfile_can_timeout, "Failed to parse keyfile-timeout= option value: %m");
@@ -310,11 +312,12 @@ static int create_disk(
"header\0",
NULL,
&header_path,
NULL,
headerdev ? &filtered_header : NULL);
if (detached_header < 0)
return log_error_errno(detached_header, "Failed to parse header= option value: %m");
tmp = fstab_filter_options(options, "tmp\0", NULL, &tmp_fstype, NULL);
tmp = fstab_filter_options(options, "tmp\0", NULL, &tmp_fstype, NULL, NULL);
if (tmp < 0)
return log_error_errno(tmp, "Failed to parse tmp= option value: %m");
@@ -602,7 +605,7 @@ static int filter_header_device(const char *options,
assert(ret_headerdev);
assert(ret_filtered_headerdev_options);
r = fstab_filter_options(options, "header\0", NULL, &headerspec, &filtered_headerspec);
r = fstab_filter_options(options, "header\0", NULL, &headerspec, NULL, &filtered_headerspec);
if (r < 0)
return log_error_errno(r, "Failed to parse header= option value: %m");