mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
cryptsetup: small if check improvement (#7747)
It's a bit weird to test these strings after the fact instead of before. Let's make sure that we don't even attempt the string escaping if the strings are NULL. Follow-up for #7688
This commit is contained in:
parent
559fdfa3e5
commit
d31eb24fc2
@ -106,9 +106,11 @@ static int create_disk(
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to generate unit name: %m");
|
||||
|
||||
password_escaped = specifier_escape(password);
|
||||
if (password && !password_escaped)
|
||||
return log_oom();
|
||||
if (password) {
|
||||
password_escaped = specifier_escape(password);
|
||||
if (!password_escaped)
|
||||
return log_oom();
|
||||
}
|
||||
|
||||
r = generator_open_unit_file(arg_dest, NULL, n, &f);
|
||||
if (r < 0)
|
||||
@ -176,9 +178,11 @@ static int create_disk(
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
filtered_escaped = specifier_escape(filtered);
|
||||
if (filtered && !filtered_escaped)
|
||||
return log_oom();
|
||||
if (filtered) {
|
||||
filtered_escaped = specifier_escape(filtered);
|
||||
if (!filtered_escaped)
|
||||
return log_oom();
|
||||
}
|
||||
|
||||
fprintf(f,
|
||||
"\n[Service]\n"
|
||||
|
Loading…
x
Reference in New Issue
Block a user