[hackers] [sbase] ls, tar: Guard inclusion of sys/sysmacros.h by absence of `major` definition || Michael Forney

From: <git_AT_suckless.org>
Date: Mon, 5 Aug 2019 23:44:12 +0200 (CEST)

commit 39f92650d33d038be5c5429e37d2d0c624b6ab38
Author: Michael Forney <mforney_AT_mforney.org>
AuthorDate: Mon Aug 5 10:13:11 2019 -0700
Commit: Michael Forney <mforney_AT_mforney.org>
CommitDate: Mon Aug 5 14:38:32 2019 -0700

    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.

diff --git a/ls.c b/ls.c
index 7de15ac..aa95fef 100644
--- a/ls.c
+++ b/ls.c
_AT_@ -1,7 +1,7 @@
 /* See LICENSE file for copyright and license details. */
 #include <sys/stat.h>
 #include <sys/types.h>
-#ifdef __GLIBC__
+#ifndef major
 #include <sys/sysmacros.h>
 #endif
 
diff --git a/tar.c b/tar.c
index fb0df45..f9158c2 100644
--- a/tar.c
+++ b/tar.c
_AT_@ -2,7 +2,7 @@
 #include <sys/stat.h>
 #include <sys/time.h>
 #include <sys/types.h>
-#ifdef __GLIBC__
+#ifndef major
 #include <sys/sysmacros.h>
 #endif
 
Received on Mon Aug 05 2019 - 23:44:12 CEST

This archive was generated by hypermail 2.3.0 : Mon Aug 05 2019 - 23:48:24 CEST