Merge pull request #23733 from sshedi/cid-1469711

homework: initialize we_detached
This commit is contained in:
Yu Watanabe 2022-06-15 12:03:24 +09:00 committed by GitHub
commit eed6ee82df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View file

@ -1603,7 +1603,7 @@ int home_activate_luks(
}
int home_deactivate_luks(UserRecord *h, HomeSetup *setup) {
bool we_detached;
bool we_detached = false;
int r;
assert(h);
@ -1619,10 +1619,8 @@ int home_deactivate_luks(UserRecord *h, HomeSetup *setup) {
r = acquire_open_luks_device(h, setup, /* graceful= */ true);
if (r < 0)
return log_error_errno(r, "Failed to initialize cryptsetup context for %s: %m", setup->dm_name);
if (r == 0) {
if (r == 0)
log_debug("LUKS device %s has already been detached.", setup->dm_name);
we_detached = false;
}
}
if (setup->crypt_device) {
@ -1631,10 +1629,9 @@ int home_deactivate_luks(UserRecord *h, HomeSetup *setup) {
cryptsetup_enable_logging(setup->crypt_device);
r = sym_crypt_deactivate_by_name(setup->crypt_device, setup->dm_name, 0);
if (ERRNO_IS_DEVICE_ABSENT(r) || r == -EINVAL) {
if (ERRNO_IS_DEVICE_ABSENT(r) || r == -EINVAL)
log_debug_errno(r, "LUKS device %s is already detached.", setup->dm_node);
we_detached = false;
} else if (r < 0)
else if (r < 0)
return log_info_errno(r, "LUKS device %s couldn't be deactivated: %m", setup->dm_node);
else {
log_info("LUKS device detaching completed.");

View file

@ -987,6 +987,8 @@ _public_ int sd_journal_seek_cursor(sd_journal *j, const char *cursor) {
case 'b':
boot_id_set = true;
r = sd_id128_from_string(word + 2, &boot_id);
if (r < 0)
return r;
break;
case 'm':