diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-09-11 23:42:01 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2022-09-18 23:47:20 +0900 |
commit | 3044d343ddcd090214ac0fdfa2cc1a5b4da93dc1 (patch) | |
tree | 499ba2ab72047a31d91be029d98918feb5999ba6 /src/dissect | |
parent | f906075a1523ec807e4e6614f4bfdea687b558cd (diff) | |
download | systemd-3044d343ddcd090214ac0fdfa2cc1a5b4da93dc1.tar.gz |
tree-wide: use dissected_image_relinquish()
Diffstat (limited to 'src/dissect')
-rw-r--r-- | src/dissect/dissect.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c index b075222ec5..a73d0f1905 100644 --- a/src/dissect/dissect.c +++ b/src/dissect/dissect.c @@ -657,7 +657,6 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) { } static int action_mount(DissectedImage *m, LoopDevice *d) { - _cleanup_(decrypted_image_unrefp) DecryptedImage *di = NULL; int r; assert(m); @@ -667,7 +666,7 @@ static int action_mount(DissectedImage *m, LoopDevice *d) { m, NULL, &arg_verity_settings, arg_flags, - &di); + NULL); if (r < 0) return r; @@ -679,19 +678,15 @@ static int action_mount(DissectedImage *m, LoopDevice *d) { if (r < 0) return log_error_errno(r, "Failed to unlock loopback block device: %m"); - if (di) { - r = decrypted_image_relinquish(di); - if (r < 0) - return log_error_errno(r, "Failed to relinquish DM devices: %m"); - } + r = dissected_image_relinquish(m); + if (r < 0) + return log_error_errno(r, "Failed to relinquish DM and loopback block devices: %m"); - loop_device_relinquish(d); return 0; } static int action_copy(DissectedImage *m, LoopDevice *d) { _cleanup_(umount_and_rmdir_and_freep) char *mounted_dir = NULL; - _cleanup_(decrypted_image_unrefp) DecryptedImage *di = NULL; _cleanup_(rmdir_and_freep) char *created_dir = NULL; _cleanup_free_ char *temp = NULL; int r; @@ -703,7 +698,7 @@ static int action_copy(DissectedImage *m, LoopDevice *d) { m, NULL, &arg_verity_settings, arg_flags, - &di); + NULL); if (r < 0) return r; @@ -731,13 +726,9 @@ static int action_copy(DissectedImage *m, LoopDevice *d) { if (r < 0) return log_error_errno(r, "Failed to unlock loopback block device: %m"); - if (di) { - r = decrypted_image_relinquish(di); - if (r < 0) - return log_error_errno(r, "Failed to relinquish DM devices: %m"); - } - - loop_device_relinquish(d); + r = dissected_image_relinquish(m); + if (r < 0) + return log_error_errno(r, "Failed to relinquish DM and loopback block devices: %m"); if (arg_action == ACTION_COPY_FROM) { _cleanup_close_ int source_fd = -1, target_fd = -1; |