mirror of
https://github.com/systemd/systemd.git
synced 2026-11-06 05:17:24 +00:00
generators: check the error fopen_unlocked() returns, not errno
The crypttab, integritytab and veritytab generators look at errno after fopen_unlocked() failed. Since fopen_unlocked() goes through xopenat_full() errno isn't necessarily set when it fails, e.g. for an empty $SYSTEMD_CRYPTTAB. Check the returned error instead. Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org> (cherry picked from commitd059194685) (cherry picked from commit18abd60f3e)
This commit is contained in:
1 parent
7a20d25946
commit
b2e1988b7e
3 files changed
+6
-6
No files matched your search
@@ -850,8 +850,8 @@ static int add_crypttab_devices(void) {
|
||||
|
||||
r = fopen_unlocked(arg_crypttab, "re", &f);
|
||||
if (r < 0) {
|
||||
if (errno != ENOENT)
|
||||
log_error_errno(errno, "Failed to open %s: %m", arg_crypttab);
|
||||
if (r != -ENOENT)
|
||||
log_error_errno(r, "Failed to open %s: %m", arg_crypttab);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,8 +138,8 @@ static int add_integritytab_devices(void) {
|
||||
|
||||
r = fopen_unlocked(arg_integritytab, "re", &f);
|
||||
if (r < 0) {
|
||||
if (errno != ENOENT)
|
||||
log_error_errno(errno, "Failed to open %s: %m", arg_integritytab);
|
||||
if (r != -ENOENT)
|
||||
log_error_errno(r, "Failed to open %s: %m", arg_integritytab);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -437,8 +437,8 @@ static int add_veritytab_devices(void) {
|
||||
|
||||
r = fopen_unlocked(arg_veritytab, "re", &f);
|
||||
if (r < 0) {
|
||||
if (errno != ENOENT)
|
||||
log_error_errno(errno, "Failed to open %s: %m", arg_veritytab);
|
||||
if (r != -ENOENT)
|
||||
log_error_errno(r, "Failed to open %s: %m", arg_veritytab);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user