[hackers] [ubase] [PATCH] Include sys/sysmacros.h when major is not defined in sys/types.h

From: Michael Forney <mforney_AT_mforney.org>
Date: Sat, 10 Aug 2019 12:58:25 -0700

This fixes the build with glibc >= 2.28 and musl >= 1.1.23.
---
 libutil/tty.c | 5 ++++-
 mknod.c       | 3 +++
 mountpoint.c  | 3 +++
 stat.c        | 3 +++
 4 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/libutil/tty.c b/libutil/tty.c
index bceb01e..f56388e 100644
--- a/libutil/tty.c
+++ b/libutil/tty.c
_AT_@ -1,6 +1,9 @@
 /* See LICENSE file for copyright and license details. */
-#include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/types.h>
+#ifndef major
+#include <sys/sysmacros.h>
+#endif
 
 #include <fcntl.h>
 #include <dirent.h>
diff --git a/mknod.c b/mknod.c
index 8de35c7..9dbede7 100644
--- a/mknod.c
+++ b/mknod.c
_AT_@ -1,6 +1,9 @@
 /* See LICENSE file for copyright and license details. */
 #include <sys/stat.h>
 #include <sys/types.h>
+#ifndef major
+#include <sys/sysmacros.h>
+#endif
 
 #include <fcntl.h>
 #include <stdio.h>
diff --git a/mountpoint.c b/mountpoint.c
index 8f205a2..726cc80 100644
--- a/mountpoint.c
+++ b/mountpoint.c
_AT_@ -1,6 +1,9 @@
 /* See LICENSE file for copyright and license details. */
 #include <sys/stat.h>
 #include <sys/types.h>
+#ifndef major
+#include <sys/sysmacros.h>
+#endif
 
 #include <mntent.h>
 #include <stdio.h>
diff --git a/stat.c b/stat.c
index 220a659..3a6569b 100644
--- a/stat.c
+++ b/stat.c
_AT_@ -1,6 +1,9 @@
 /* See LICENSE file for copyright and license details. */
 #include <sys/stat.h>
 #include <sys/types.h>
+#ifndef major
+#include <sys/sysmacros.h>
+#endif
 
 #include <inttypes.h>
 #include <stdio.h>
-- 
2.20.1
Received on Sat Aug 10 2019 - 21:58:25 CEST

This archive was generated by hypermail 2.3.0 : Sun Aug 11 2019 - 06:24:24 CEST