summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-12-10 01:08:13 -0500
committerGitHub <noreply@github.com>2016-12-10 01:08:13 -0500
commit4a5567d5d6ab01974dd089eb8907fecd6aff4fcf (patch)
tree4f40cdd195f08022e2846d5c9757147ca436fede /src/core
parent2e1f244efd2dfc1a60d032bef3d88b9ba6e0444b (diff)
parent58abb66f4b9b0b3a16fe29211454d9936d35c35d (diff)
Merge pull request #4795 from poettering/dissect
Generalize image dissection logic of nspawn, and make it useful for other tools.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/umount.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/core/umount.c b/src/core/umount.c
index 1e5459ed80..2f4b12bdb9 100644
--- a/src/core/umount.c
+++ b/src/core/umount.c
@@ -344,24 +344,29 @@ static int delete_loopback(const char *device) {
}
static int delete_dm(dev_t devnum) {
- _cleanup_close_ int fd = -1;
- int r;
+
struct dm_ioctl dm = {
- .version = {DM_VERSION_MAJOR,
- DM_VERSION_MINOR,
- DM_VERSION_PATCHLEVEL},
+ .version = {
+ DM_VERSION_MAJOR,
+ DM_VERSION_MINOR,
+ DM_VERSION_PATCHLEVEL
+ },
.data_size = sizeof(dm),
.dev = devnum,
};
+ _cleanup_close_ int fd = -1;
+
assert(major(devnum) != 0);
fd = open("/dev/mapper/control", O_RDWR|O_CLOEXEC);
if (fd < 0)
return -errno;
- r = ioctl(fd, DM_DEV_REMOVE, &dm);
- return r >= 0 ? 0 : -errno;
+ if (ioctl(fd, DM_DEV_REMOVE, &dm) < 0)
+ return -errno;
+
+ return 0;
}
static int mount_points_list_umount(MountPoint **head, bool *changed, bool log_error) {