summaryrefslogtreecommitdiff
path: root/src/shared/loop-util.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-09-09 05:12:07 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2022-09-09 05:16:41 +0900
commit833106b87606930bd8d8261d37ee686c784fd0ae (patch)
tree8ef13b4606c0855fe98205e7b67b67cf11844b57 /src/shared/loop-util.c
parent53274fdb59ea2c68253cb143791de1aea5168183 (diff)
downloadsystemd-833106b87606930bd8d8261d37ee686c784fd0ae.tar.gz
loop-util: do not try to enumerate partitions twice
Diffstat (limited to 'src/shared/loop-util.c')
-rw-r--r--src/shared/loop-util.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/shared/loop-util.c b/src/shared/loop-util.c
index 1cc3f2642e..49f4b2bf6e 100644
--- a/src/shared/loop-util.c
+++ b/src/shared/loop-util.c
@@ -277,19 +277,13 @@ static int loop_configure(
* superficially is detached but still has partition block devices associated for it. Let's then
* manually remove the partitions via BLKPG, and tell the caller we did that via EUCLEAN, so they try
* again. */
- r = block_device_has_partitions(dev);
+ r = block_device_remove_all_partitions(dev, fd);
if (r < 0)
return r;
- if (r > 0) {
- /* Remove all partitions, and report this to the caller, to try again, and count this as
+ if (r > 0)
+ /* Removed all partitions. Let's report this to the caller, to try again, and count this as
* an attempt. */
-
- r = block_device_remove_all_partitions(dev, fd);
- if (r < 0)
- return r;
-
return -EUCLEAN;
- }
if (!loop_configure_broken) {
/* Acquire uevent seqnum immediately before attaching the loopback device. This allows