mirror of
https://github.com/systemd/systemd.git
synced 2026-08-09 01:20:53 +00:00
homework: initialize we_detached
Fixes: CID#1469711 CID 1469711 (#1 of 1): Uninitialized scalar variable (UNINIT) 14. uninit_use: Using uninitialized value we_detached.
This commit is contained in:
@@ -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.");
|
||||
|
||||
Reference in New Issue
Block a user