mirror of
https://github.com/SELinuxProject/selinux
synced 2025-05-10 19:48:03 +00:00
libselinux: be careful with non-portable LFS macro
musl does not provide the obsolete LFS64 APIs (like ino64_t) — ino_t
has always been 64-bit on all platforms there. That means there's
also no __INO_T_MATCHES_INO64_T macro, meaning the check would pass
and reach the static asserts for the shim, which would fail due to
there being no ino64_t to check the size of. Fix this by only
assuming the absense of __INO_T_MATCHES_INO64_t is meaningful when
another non-portable Glibc macro, __INO64_T_TYPE, is defined. If both
are missing, that probably just means there is no ino64_t.
Fixes: 5c3fcbd9
("Inject matchpathcon_filespec_add64() if !defined(__INO_T_MATCHES_INO64_T) instead of using __BITS_PER_LONG < 64 as proxy")
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
parent
04a592bf2f
commit
21dd00713a
@ -537,7 +537,7 @@ extern int matchpathcon_index(const char *path,
|
||||
with the same inode (e.g. due to multiple hard links). If so, then
|
||||
use the latter of the two specifications based on their order in the
|
||||
file contexts configuration. Return the used specification index. */
|
||||
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 && !defined(__INO_T_MATCHES_INO64_T)
|
||||
#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64 && defined(__INO64_T_TYPE) && !defined(__INO_T_MATCHES_INO64_T)
|
||||
#define matchpathcon_filespec_add matchpathcon_filespec_add64
|
||||
#endif
|
||||
extern int matchpathcon_filespec_add(ino_t ino, int specind, const char *file);
|
||||
|
@ -261,7 +261,7 @@ int matchpathcon_filespec_add(ino_t ino, int specind, const char *file)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64) && !defined(__INO_T_MATCHES_INO64_T)
|
||||
#if (defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64) && defined(__INO64_T_TYPE) && !defined(__INO_T_MATCHES_INO64_T)
|
||||
/* alias defined in the public header but we undefine it here */
|
||||
#undef matchpathcon_filespec_add
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user