From 0d29e12553cd9f51c1d4428ea373cdb8c62fbcf2 Mon Sep 17 00:00:00 2001 From: Kinga Stefaniuk Date: Wed, 9 Oct 2024 08:48:20 +0200 Subject: util: use only /dev directory in open_dev() Previously, open_dev() tried to open device in two ways - using /dev and /tmp directory. This method could be used by users which have no access to /tmp directory (e.g. udev) and dev_open() fails which may affect many processes. Remove try to open in /tmp directory. Signed-off-by: Kinga Stefaniuk --- util.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/util.c b/util.c index 7c5c5c8f..f05392a2 100644 --- a/util.c +++ b/util.c @@ -1111,17 +1111,6 @@ int dev_open(char *dev, int flags) fd = open(devname, flags); unlink(devname); } - if (fd < 0) { - /* Try /tmp as /dev appear to be read-only */ - snprintf(devname, sizeof(devname), - "/tmp/.tmp.md.%d:%d:%d", - (int)getpid(), major, minor); - if (mknod(devname, S_IFBLK|0600, - makedev(major, minor)) == 0) { - fd = open(devname, flags); - unlink(devname); - } - } } else fd = open(dev, flags); return fd; -- cgit v1.2.3