help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/2] examples/loadables/finfo: correctly include sys/sysmacros.h


From: Eli Schwartz
Subject: [PATCH 1/2] examples/loadables/finfo: correctly include sys/sysmacros.h
Date: Mon, 4 Nov 2019 14:47:40 -0500

Many projects historically relied on including this via sys/types.h, but
this was deprecated by glibc 2.25 and dropped fully in glibc 2.28:
https://sourceware.org/ml/libc-alpha/2015-11/msg00253.html

Add autoconf check for the location of major/minor/makedev, and add
defines to include the correct header if it is detected outside of
sys/types.h
---
 configure.ac               | 1 +
 examples/loadables/finfo.c | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/configure.ac b/configure.ac
index cf5d1ed5..1b26587a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -743,6 +743,7 @@ AM_GNU_GETTEXT([no-libtool], [need-ngettext], [lib/intl])
 dnl header files
 AC_HEADER_DIRENT
 AC_HEADER_TIME
+AC_HEADER_MAJOR
 
 BASH_HEADER_INTTYPES
 
diff --git a/examples/loadables/finfo.c b/examples/loadables/finfo.c
index 4273aa59..323ecac4 100644
--- a/examples/loadables/finfo.c
+++ b/examples/loadables/finfo.c
@@ -28,6 +28,12 @@
 #endif
 
 #include <sys/types.h>
+#ifdef MAJOR_IN_MKDEV
+#    include <sys/mkdev.h>
+#endif
+#ifdef MAJOR_IN_SYSMACROS
+#    include <sys/sysmacros.h>
+#endif
 #include "posixstat.h"
 #include <stdio.h>
 #include <pwd.h>
-- 
2.23.0



reply via email to

[Prev in Thread] Current Thread [Next in Thread]