ls, tar: Guard inclusion of sys/sysmacros.h by absence of major definition

Since musl 1.1.23, it too does not provide `major` and `minor` through
sys/types.h, so instead include sys/sysmacros.h based on the absence of
`major` rather than only on glibc.

Thanks to Rich Felker for the suggestion.
This commit is contained in:
Michael Forney 2019-08-05 10:13:11 -07:00
parent 7315b8686f
commit 39f92650d3
2 changed files with 2 additions and 2 deletions

2
ls.c
View File

@ -1,7 +1,7 @@
/* See LICENSE file for copyright and license details. */ /* See LICENSE file for copyright and license details. */
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef __GLIBC__ #ifndef major
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#endif #endif

2
tar.c
View File

@ -2,7 +2,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef __GLIBC__ #ifndef major
#include <sys/sysmacros.h> #include <sys/sysmacros.h>
#endif #endif