@@ -352,10 +352,14 @@ int matchpathcon_init_prefix(const char *path, const char *subset)
return hnd ? 0 : -1;
}
+int matchpathcon_init2(const char *path)
+{
+ return matchpathcon_init_prefix(path, NULL);
+}
int matchpathcon_init(const char *path)
{
- return matchpathcon_init_prefix(path, NULL);
+ return matchpathcon_init2(path);
}
void matchpathcon_fini2(void)
@@ -1,6 +1,8 @@
#ifndef SRC_MATCHPATHCON_INTERNAL_H_
#define SRC_MATCHPATHCON_INTERNAL_H_
+int matchpathcon_init2(const char *path);
+
void matchpathcon_fini2(void);
int matchpathcon2(const char *path, mode_t mode, char ** con);
@@ -58,6 +58,12 @@ sefcontext_compile: LDLIBS += $(PCRE_LDLIBS) ../src/libselinux.a -lsepol
sefcontext_compile: sefcontext_compile.o ../src/regex.o
+matchpathcon: LDLIBS += $(PCRE_LDLIBS) ../src/libselinux.a
+
+matchpathcon: CFLAGS += -I../src
+
+matchpathcon: matchpathcon.o ../src/regex.o
+
all: $(TARGETS)
install: all
@@ -11,6 +11,9 @@
#include <limits.h>
#include <stdlib.h>
+#include "matchpathcon_internal.h"
+
+
static __attribute__ ((__noreturn__)) void usage(const char *progname)
{
fprintf(stderr,
@@ -22,7 +25,7 @@ static __attribute__ ((__noreturn__)) void usage(const char *progname)
static int printmatchpathcon(const char *path, int header, int mode)
{
char *buf;
- int rc = matchpathcon(path, mode, &buf);
+ int rc = matchpathcon2(path, mode, &buf);
if (rc < 0) {
if (errno == ENOENT) {
buf = strdup("<<none>>");
@@ -103,7 +106,7 @@ int main(int argc, char **argv)
exit(1);
}
init = 1;
- if (matchpathcon_init(optarg)) {
+ if (matchpathcon_init2(optarg)) {
fprintf(stderr,
"Error while processing %s: %s\n",
optarg,
@@ -195,6 +198,6 @@ int main(int argc, char **argv)
error |= printmatchpathcon(path, header, mode);
}
}
- matchpathcon_fini();
+ matchpathcon_fini2();
return error;
}