From f22ce6351a2e86371ac7c9edcea39d250e35bf2d Mon Sep 17 00:00:00 2001 From: June 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 282d9f03..5c1a057e 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