blockd: detect mountpoint of /dev/mapper/*
authorDaniel Golle <daniel@makrotopia.org>
Wed, 14 Jul 2021 01:58:12 +0000 (02:58 +0100)
committerDaniel Golle <daniel@makrotopia.org>
Wed, 14 Jul 2021 04:30:29 +0000 (05:30 +0100)
If a device cannot be found in /dev, also try /dev/mapper.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
blockd.c

index d6dfeb8ff0ad590f8b44925d5375a9863065bfb0..f6973d8e4ffd362fd65fc84a00b363c06a2e0bf1 100644 (file)
--- a/blockd.c
+++ b/blockd.c
@@ -89,6 +89,15 @@ _find_mount_point(char *device)
        mp = find_mount_point(dev, 0);
        free(dev);
 
+       if (mp)
+               return mp;
+
+       if (asprintf(&dev, "/dev/mapper/%s", device) == -1)
+               exit(ENOMEM);
+
+       mp = find_mount_point(dev, 0);
+       free(dev);
+
        return mp;
 }
 
@@ -584,8 +593,8 @@ static int autofs_mount(void)
 
        uloop_timeout_set(&autofs_expire_timer, AUTOFS_EXPIRE_TIMER);
 
-        fcntl(fd_autofs_write, F_SETFD, fcntl(fd_autofs_write, F_GETFD) | FD_CLOEXEC);
-        fcntl(fd_autofs_read.fd, F_SETFD, fcntl(fd_autofs_read.fd, F_GETFD) | FD_CLOEXEC);
+       fcntl(fd_autofs_write, F_SETFD, fcntl(fd_autofs_write, F_GETFD) | FD_CLOEXEC);
+       fcntl(fd_autofs_read.fd, F_SETFD, fcntl(fd_autofs_read.fd, F_GETFD) | FD_CLOEXEC);
 
        return 0;
 }