diff --git a/src/cryptsetup/cryptsetup-generator.c b/src/cryptsetup/cryptsetup-generator.c index 24ccf04273..cada032bb9 100644 --- a/src/cryptsetup/cryptsetup-generator.c +++ b/src/cryptsetup/cryptsetup-generator.c @@ -152,8 +152,10 @@ static int create_disk( return log_oom(); } - if (keydev && !password) - return log_error_errno(-EINVAL, "Keydev is specified, but path to the password file is missing: %m"); + if (keydev && !password) { + log_error("Key device is specified, but path to the password file is missing."); + return -EINVAL; + } r = generator_open_unit_file(arg_dest, NULL, n, &f); if (r < 0) @@ -190,7 +192,7 @@ static int create_disk( netdev ? "remote-cryptsetup.target" : "cryptsetup.target"); if (password) { - if (STR_IN_SET(password, "/dev/urandom", "/dev/random", "/dev/hw_random")) + if (PATH_IN_SET(password, "/dev/urandom", "/dev/random", "/dev/hw_random")) fputs("After=systemd-random-seed.service\n", f); else if (!STR_IN_SET(password, "-", "none")) { _cleanup_free_ char *uu;