diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-08-09 17:03:15 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-08-16 12:52:56 +0200 |
commit | bb44fd073402cdfdbf2dfee549708a93c7c73aaf (patch) | |
tree | 802e8c24a376d24c86c0b89b4aec5cc227177881 /src/home/homework-luks.c | |
parent | libsystemd-network: use _NEG_ macros to reduce indentation (diff) | |
download | systemd-bb44fd073402cdfdbf2dfee549708a93c7c73aaf.tar.xz systemd-bb44fd073402cdfdbf2dfee549708a93c7c73aaf.zip |
various: use _NEG_ macros to reduce indentation
No functional change intended.
Diffstat (limited to 'src/home/homework-luks.c')
-rw-r--r-- | src/home/homework-luks.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/home/homework-luks.c b/src/home/homework-luks.c index 23a29d5811..3b3090a136 100644 --- a/src/home/homework-luks.c +++ b/src/home/homework-luks.c @@ -498,11 +498,10 @@ static int acquire_open_luks_device( return r; r = sym_crypt_init_by_name(&cd, setup->dm_name); - if (r < 0) { - if ((ERRNO_IS_DEVICE_ABSENT(r) || r == -EINVAL) && graceful) - return 0; + if ((ERRNO_IS_NEG_DEVICE_ABSENT(r) || r == -EINVAL) && graceful) + return 0; + if (r < 0) return log_error_errno(r, "Failed to initialize cryptsetup context for %s: %m", setup->dm_name); - } cryptsetup_enable_logging(cd); @@ -1639,12 +1638,11 @@ 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 (r < 0) { - if (ERRNO_IS_DEVICE_ABSENT(r) || r == -EINVAL) - log_debug_errno(r, "LUKS device %s is already detached.", setup->dm_node); - else - return log_info_errno(r, "LUKS device %s couldn't be deactivated: %m", setup->dm_node); - } else { + if (ERRNO_IS_NEG_DEVICE_ABSENT(r) || r == -EINVAL) + log_debug_errno(r, "LUKS device %s is already detached.", setup->dm_node); + 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."); we_detached = true; } @@ -2026,11 +2024,10 @@ static int wait_for_devlink(const char *path) { return log_error_errno(SYNTHETIC_ERRNO(ETIMEDOUT), "Device link %s still hasn't shown up, giving up.", path); r = fd_wait_for_event(inotify_fd, POLLIN, until - w); - if (r < 0) { - if (ERRNO_IS_TRANSIENT(r)) - continue; + if (ERRNO_IS_NEG_TRANSIENT(r)) + continue; + if (r < 0) return log_error_errno(r, "Failed to watch inotify: %m"); - } (void) flush_fd(inotify_fd); } |