musl: glob-util: filter out . and .. even if GLOB_ALTDIRFUNC is not supported

musl neither support GLOB_ALTDIRFUNC nor GLOB_BRACE.
Let's make safe_glob() work even when GLOB_ALTDIRFUNC is not supported.
Currently, GLOB_BRACE is simply ignored when it is not supported.
This commit is contained in:
Yu Watanabe
2025-11-17 12:19:22 +09:00
parent 3bc03c67f0
commit 07e437f569
2 changed files with 94 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#pragma once
#include_next <glob.h>
#ifndef GLOB_ALTDIRFUNC
#define GLOB_ALTDIRFUNC (1 << 9)
#define gl_flags __dummy1
#define gl_closedir __dummy2[0]
#define gl_readdir __dummy2[1]
#define gl_opendir __dummy2[2]
#define gl_lstat __dummy2[3]
#define gl_stat __dummy2[4]
#endif
#ifndef GLOB_BRACE
#define GLOB_BRACE (1 << 10)
#endif