mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-07-21 10:16:14 +00:00
pipewire: impl-module: only stat if necessary
On some filesystems, the directory entry type is immediately available, so use that to check if the entity is a directory, and only use `stat()` when the entity type cannot be determined from the directory entry.
This commit is contained in:
parent
f82f215bf7
commit
f8344a3908
|
@ -75,7 +75,8 @@ static char *find_module(const char *path, const char *name, int level)
|
|||
if (newpath == NULL)
|
||||
break;
|
||||
|
||||
if (stat(newpath, &s) == 0 && S_ISDIR(s.st_mode))
|
||||
if (entry->d_type == DT_DIR ||
|
||||
(entry->d_type == DT_UNKNOWN && stat(newpath, &s) == 0 && S_ISDIR(s.st_mode)))
|
||||
filename = find_module(newpath, name, level - 1);
|
||||
|
||||
free(newpath);
|
||||
|
|
Loading…
Reference in a new issue