summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Bosboom2025-12-14 06:38:47 +0000
committerDaniel Golle2026-03-14 00:29:08 +0000
commitb8c4f862cb1dbc3c742cbd4953a7c636f73765fc (patch)
tree2658d1dde974934a3f5e75a3ad4caa06e1f61b53
parent1f2aa1a78486ad693e031d32773898a0427b578f (diff)
downloadprocd-b8c4f862cb1dbc3c742cbd4953a7c636f73765fc.tar.gz
hotplug-dispatch: use stat if d_type is DT_UNKNOWN
As documented in the readdir man page, support for d_type varies by filesystem. The ISO 9660 filesystem used in the x86 target's bootable ISO images always sets d_type to DT_UNKNOWN. Fall back to checking S_ISDIR(st_mode) when d_type is DT_UNKNOWN. Fixes: 08938fe ("procd: add hotplug-call dispatcher") Signed-off-by: Jeffrey Bosboom <jbosboom@jeffreybosboom.com> (cherry picked from commit c4e9859876d5db7d8d69e8dc92bc7fde44ee96ec)
-rw-r--r--hotplug-dispatch.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/hotplug-dispatch.c b/hotplug-dispatch.c
index 4706085..16c22b7 100644
--- a/hotplug-dispatch.c
+++ b/hotplug-dispatch.c
@@ -370,6 +370,7 @@ static int init_subsystems(void)
{
DIR *dir;
struct dirent *dirent;
+ struct stat st;
dir = opendir(HOTPLUG_BASEDIR);
if (dir == NULL)
@@ -377,7 +378,11 @@ static int init_subsystems(void)
while ((dirent = readdir(dir))) {
/* skip everything but directories */
- if (dirent->d_type != DT_DIR)
+ if (dirent->d_type == DT_UNKNOWN) {
+ if ((fstatat(dirfd(dir), dirent->d_name, &st, AT_SYMLINK_NOFOLLOW) == -1)
+ || !S_ISDIR(st.st_mode))
+ continue;
+ } else if (dirent->d_type != DT_DIR)
continue;
/* skip '.' and '..' as well as hidden files */