From 60dc44b707149e31fa766885574484aa5172f498 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 18 Oct 2021 21:50:56 +0200 Subject: [PATCH] dev-cache: enhance dir scan also for non-udev build --- lib/device/dev-cache.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c index 57fa916a9..c6e5f68cf 100644 --- a/lib/device/dev-cache.c +++ b/lib/device/dev-cache.c @@ -1099,9 +1099,17 @@ static int _device_in_udev_db(const dev_t d) static void _insert_dirs(struct dm_list *dirs) { struct dir_list *dl; + struct stat tinfo; - dm_list_iterate_items(dl, &_cache.dirs) + dm_list_iterate_items(dl, &_cache.dirs) { + if (stat(dl->dir, &tinfo) < 0) { + log_warn("WARNING: Cannot use dir %s, %s.", + dl->dir, strerror(errno)); + continue; + } + _cache.st_dev = tinfo.st_dev; _insert_dir(dl->dir); + } } #endif /* UDEV_SYNC_SUPPORT */