mirror of
https://github.com/systemd/systemd.git
synced 2024-11-01 00:51:24 +03:00
machine-image: handle nicely if the user asks us to remove a symlinked image
Much like for dirs/raw images lets remove the symlink and not the destination.
This commit is contained in:
parent
759aaedc5c
commit
9fb0b9c70d
@ -483,9 +483,15 @@ int image_remove(Image *i) {
|
||||
switch (i->type) {
|
||||
|
||||
case IMAGE_SUBVOLUME:
|
||||
r = btrfs_subvol_remove(i->path, BTRFS_REMOVE_RECURSIVE|BTRFS_REMOVE_QUOTA);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
/* Let's unlink first, maybe it is a symlink? If that works we are happy. Otherwise, let's get out the
|
||||
* big guns */
|
||||
if (unlink(i->path) < 0) {
|
||||
r = btrfs_subvol_remove(i->path, BTRFS_REMOVE_RECURSIVE|BTRFS_REMOVE_QUOTA);
|
||||
if (r < 0)
|
||||
return r;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case IMAGE_DIRECTORY:
|
||||
|
Loading…
Reference in New Issue
Block a user