From 1d681ca59cada118633c6e2d65b882b4c8f0db58 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Sat, 24 Jul 2021 00:52:44 +0100 Subject: [PATCH] block: support umount device basename blockd calls the umount action with the basename of the device rather than the full path. Signed-off-by: Daniel Golle --- block.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/block.c b/block.c index ae5adf0..c9b61af 100644 --- a/block.c +++ b/block.c @@ -1108,10 +1108,19 @@ static int mount_device(struct probe_info *pr, int type) static int umount_device(char *path, int type, bool all) { - char *mp; + char *mp, *devpath; int err; - mp = find_mount_point(path); + if (strlen(path) > 5 && !strncmp("/dev/", path, 5)) { + mp = find_mount_point(path); + } else { + devpath = malloc(strlen(path) + 6); + strcpy(devpath, "/dev/"); + strcat(devpath, path); + mp = find_mount_point(devpath); + free(devpath); + } + if (!mp) return -1; if (!strcmp(mp, "/") && !all) -- 2.30.2