summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
authorAndrew Kaster <akaster@serenityos.org>2022-07-04 15:33:37 -0600
committerAndreas Kling <kling@serenityos.org>2022-07-05 01:27:37 +0200
commitc774790975f136bcff70dd4e9fa444f100f34003 (patch)
tree786fdd7a21ab9f01831bc7f20bd51b81784ccea1 /Userland
parentd40167f7bb6f5ca5e0bb2dd8aaacf46441f1211c (diff)
downloadserenity-c774790975f136bcff70dd4e9fa444f100f34003.zip
LibArchive: Guard against major() and minor() macros from old glibc
glibc before 2.28 defines major() and minor() macros from sys/types.h. This triggers a Lagom warning for old distros that use versions older than that, such as Ubuntu 18.04. This fixes a break in the compiler-explorer Lagom build, which is based off 18.04 docker containers.
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibArchive/Tar.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/Userland/Libraries/LibArchive/Tar.h b/Userland/Libraries/LibArchive/Tar.h
index 7474c9cb2a..af2bd9f171 100644
--- a/Userland/Libraries/LibArchive/Tar.h
+++ b/Userland/Libraries/LibArchive/Tar.h
@@ -13,6 +13,16 @@
#include <string.h>
#include <sys/types.h>
+// glibc before 2.28 defines these from sys/types.h, but we don't want
+// TarFileHeader::major() and TarFileHeader::minor() to use those macros
+#ifdef minor
+# undef minor
+#endif
+
+#ifdef major
+# undef major
+#endif
+
namespace Archive {
enum class TarFileType : char {