blob: 8e73e077049df1e8d9789e1f26b7c190874c17aa [file] [log] [blame]
From 1b3a182f38895de5ea8dda5a77867345845fb967 Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Mon, 18 Dec 2023 12:25:04 +0200
Subject: [PATCH] Fix unconditional dependency on non-POSIX GLOB_ONLYDIR flag
This regressed when we axed our internal glob copy in commit
66fa46c006bae0f28d93238b8f7f1c923645eee5. Luckily GLOB_ONLYDIR is only
an optimization so we can just skip it if not available.
Upstream-Status: Backport [https://github.com/rpm-software-management/rpm/commit/57f3711846f44da0f37cbc5dd66e8fba80a3bee1]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
CMakeLists.txt | 1 +
config.h.in | 1 +
rpmio/rpmglob.c | 2 ++
3 files changed, 4 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d0ea565f3..0a474106e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -351,6 +351,7 @@ if (LIBDW_FOUND)
set(HAVE_LIBDW 1)
endif()
+check_symbol_exists(GLOB_ONLYDIR "glob.h" HAVE_GLOB_ONLYDIR)
check_symbol_exists(major "sys/sysmacros.h" MAJOR_IN_SYSMACROS)
if (NOT MAJOR_IN_SYSMACROS)
check_symbol_exists(major "sys/mkdev.h" MAJOR_IN_MKDEV)
diff --git a/config.h.in b/config.h.in
index cb97827d0..ab1757a9a 100644
--- a/config.h.in
+++ b/config.h.in
@@ -100,6 +100,7 @@
#cmakedefine HAVE_ZSTD @HAVE_ZSTD@
#cmakedefine HAVE___PROGNAME @HAVE___PROGNAME@
#cmakedefine HAVE___SECURE_GETENV @HAVE___SECURE_GETENV@
+#cmakedefine HAVE_GLOB_ONLYDIR @HAVE_GLOB_ONLYDIR@
#cmakedefine MAJOR_IN_MKDEV @MAJOR_IN_MKDEV@
#cmakedefine MAJOR_IN_SYSMACROS @MAJOR_IN_SYSMACROS@
#cmakedefine RUNDIR @rundir@
diff --git a/rpmio/rpmglob.c b/rpmio/rpmglob.c
index 8276eddb4..243568766 100644
--- a/rpmio/rpmglob.c
+++ b/rpmio/rpmglob.c
@@ -84,8 +84,10 @@ int rpmGlobPath(const char * pattern, rpmglobFlags flags,
gflags |= GLOB_BRACE;
if (home != NULL && strlen(home) > 0)
gflags |= GLOB_TILDE;
+#if HAVE_GLOB_ONLYDIR
if (dir_only)
gflags |= GLOB_ONLYDIR;
+#endif
if (flags & RPMGLOB_NOCHECK)
gflags |= GLOB_NOCHECK;