Inlined patch adds support for pledge() in par formatter. It's rather
complicated program, but in that cost, it provides more eyes-pleasant
results than fmt from the base, and has much more options. Because of
its complexity I think pledge()'ing it makes sense.

I've tested it with english and utf8 texts - it behaves like before.

Tests, comments, objections?

diff --git a/textproc/par/Makefile b/textproc/par/Makefile
index 238299d2229..fb4da25b775 100644
--- a/textproc/par/Makefile
+++ b/textproc/par/Makefile
@@ -5,7 +5,7 @@ COMMENT=        paragraph reflow for email
 VERSION=       1.52
 DISTNAME=      Par${VERSION:S/.//}
 PKGNAME=       par-${VERSION}
-REVISION=      1
+REVISION=      2
 CATEGORIES=    textproc
 FIX_EXTRACT_PERMISSIONS=Yes
 
diff --git a/textproc/par/patches/patch-par_c b/textproc/par/patches/patch-par_c
new file mode 100644
index 00000000000..4e33f79063a
--- /dev/null
+++ b/textproc/par/patches/patch-par_c
@@ -0,0 +1,25 @@
+Index: par.c
+--- par.c.orig
++++ par.c
+@@ -20,6 +20,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <wchar.h>
++#include <unistd.h>
+ 
+ #undef NULL
+ #define NULL ((void *) 0)
+@@ -730,6 +731,13 @@ int main(int argc, const char * const *argv)
+ /* Set the current locale from the environment: */
+ 
+   setlocale(LC_ALL,"");
++
++/* setlocale() needs "rpath", so do the syscall after it */
++
++  if (pledge("stdio", NULL) == -1) {
++    wcscpy(errmsg, L"pledge\n");
++    goto parcleanup;
++  }
+ 
+ /* Process environment variables: */
+ 

Reply via email to