- if (streq(password, "/dev/urandom") ||
- streq(password, "/dev/random") ||
- streq(password, "/dev/hw_random"))
- fputs("After=systemd-random-seed-load.service\n", f);
- else if (!streq(password, "-") &&
- !streq(password, "none"))
- fprintf(f,
- "RequiresMountsFor=%s\n",
- password);
+ if (STR_IN_SET(password, "/dev/urandom", "/dev/random", "/dev/hw_random"))
+ fputs("After=systemd-random-seed.service\n", f);
+ else if (!streq(password, "-") && !streq(password, "none")) {
+ _cleanup_free_ char *uu;
+
+ uu = fstab_node_to_udev_node(password);
+ if (!uu)
+ return log_oom();
+
+ if (!path_equal(uu, "/dev/null")) {
+
+ if (is_device_path(uu)) {
+ _cleanup_free_ char *dd;
+
+ dd = unit_name_from_path(uu, ".device");
+ if (!dd)
+ return log_oom();
+
+ fprintf(f, "After=%1$s\nRequires=%1$s\n", dd);
+ } else
+ fprintf(f, "RequiresMountsFor=%s\n", password);
+ }
+ }