mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-09 13:30:06 -05: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
1 changed files with 2 additions and 1 deletions
|
|
@ -75,7 +75,8 @@ static char *find_module(const char *path, const char *name, int level)
|
||||||
if (newpath == NULL)
|
if (newpath == NULL)
|
||||||
break;
|
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);
|
filename = find_module(newpath, name, level - 1);
|
||||||
|
|
||||||
free(newpath);
|
free(newpath);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue