fstab-generator: drop assertions for mount opts

fstab_filter_options accepts NULL and (with later changes)
might even return NULL.
This commit is contained in:
Mike Yuan
2024-01-26 01:06:40 +08:00
parent 215286a405
commit c521ce42b4
+6 -9
View File
@@ -481,17 +481,13 @@ static int mandatory_mount_drop_unapplicable_options(
assert(flags);
assert(where);
assert(options);
assert(ret_options);
if (!(*flags & (MOUNT_NOAUTO|MOUNT_NOFAIL|MOUNT_AUTOMOUNT))) {
_cleanup_free_ char *opts = NULL;
r = strdup_or_null(options, ret_options);
if (r < 0)
return r;
opts = strdup(options);
if (!opts)
return -ENOMEM;
*ret_options = TAKE_PTR(opts);
return 0;
}
@@ -527,7 +523,6 @@ static int add_mount(
assert(what);
assert(where);
assert(opts);
assert(target_unit);
assert(source);
@@ -840,6 +835,9 @@ static int add_sysusr_sysroot_usr_bind_mount(const char *source) {
static MountPointFlags fstab_options_to_flags(const char *options, bool is_swap) {
MountPointFlags flags = 0;
if (isempty(options))
return 0;
if (fstab_test_option(options, "x-systemd.makefs\0"))
flags |= MOUNT_MAKEFS;
if (fstab_test_option(options, "x-systemd.growfs\0"))
@@ -915,7 +913,6 @@ static int parse_fstab_one(
assert(what_original);
assert(fstype);
assert(options);
if (prefix_sysroot && !mount_in_initrd(where_original, options, accept_root))
return 0;