[PATCH 1/2] libselinux: support building on older PCRE libs

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

 



Versions of PCRE prior to 8.20 did not have pcre_free_study().  In its
absence, use pcre_free() instead.

Signed-off-by: Joe MacDonald <joe@xxxxxxxxxxxx>
---
 libselinux/src/label_file.c           |    4 ++++
 libselinux/utils/sefcontext_compile.c |    4 ++++
 2 files changed, 8 insertions(+)

diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c
index 9b0d6b0..51520cf 100644
--- a/libselinux/src/label_file.c
+++ b/libselinux/src/label_file.c
@@ -561,7 +561,11 @@ static void closef(struct selabel_handle *rec)
 		free(spec->type_str);
 		if (spec->regcomp) {
 			pcre_free(spec->regex);
+#if (PCRE_MAJOR >= 8 && PCRE_MINOR >= 20)
 			pcre_free_study(spec->sd);
+#else
+			pcre_free(spec->sd);
+#endif
 		}
 	}
 
diff --git a/libselinux/utils/sefcontext_compile.c b/libselinux/utils/sefcontext_compile.c
index 6f79dd6..b34966b 100644
--- a/libselinux/utils/sefcontext_compile.c
+++ b/libselinux/utils/sefcontext_compile.c
@@ -301,7 +301,11 @@ static int free_specs(struct saved_data *data)
 		free(specs[i].lr.ctx_trans);
 		free(specs[i].regex_str);
 		pcre_free(specs[i].regex);
+#if (PCRE_MAJOR >= 8 && PCRE_MINOR >= 20)
 		pcre_free_study(specs[i].sd);
+#else
+		pcre_free(specs[i].sd);
+#endif
 	}
 	free(specs);
 
-- 
1.7.9.5


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.




[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux