From 3f9a828c38a72218e42504ddb9b398331ddce3d8 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Thu, 30 Sep 2021 02:46:34 +0000 Subject: pledge(2) mtags --- bin/mtags.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'bin/mtags.c') diff --git a/bin/mtags.c b/bin/mtags.c index 1ebfbac5..11cd9c8a 100644 --- a/bin/mtags.c +++ b/bin/mtags.c @@ -34,6 +34,7 @@ static void escape(FILE *file, const char *str, size_t len) { } int main(int argc, char *argv[]) { + int error; bool append = false; const char *path = "tags"; for (int opt; 0 < (opt = getopt(argc, argv, "af:"));) { @@ -47,10 +48,15 @@ int main(int argc, char *argv[]) { FILE *tags = fopen(path, (append ? "a" : "w")); if (!tags) err(EX_CANTCREAT, "%s", path); +#ifdef __OpenBSD__ + error = pledge("stdio rpath", NULL); + if (error) err(EX_OSERR, "pledge"); +#endif + regex_t makeFile, makeLine; regex_t mdocFile, mdocLine; regex_t shFile, shLine; - int error = 0 + error = 0 || regcomp(&makeFile, "(^|/)Makefile|[.]mk$", REG_EXTENDED | REG_NOSUB) || regcomp( &makeLine, -- cgit 1.4.1