URI: 
       add OpenBSD pledge(2) support using -DUSE_PLEDGE - stagit-gopher - A git gopher frontend. (mirror)
  HTML git clone git://bitreich.org/stagit-gopher/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/stagit-gopher/
   DIR Log
   DIR Files
   DIR Refs
   DIR Tags
   DIR README
   DIR LICENSE
       ---
   DIR commit aa36e0c9b4d8da06c5dc03a461f9d3fe69a1e7fb
   DIR parent eae9437f944f04619cbda9ce7eb460f6ff0d7f4c
  HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Tue,  3 May 2016 00:33:56 +0200
       
       add OpenBSD pledge(2) support using -DUSE_PLEDGE
       
       Diffstat:
         M config.mk                           |      10 +++++++---
         M stagit-index.c                      |      11 +++++++++++
         M stagit.c                            |      11 +++++++++++
       
       3 files changed, 29 insertions(+), 3 deletions(-)
       ---
   DIR diff --git a/config.mk b/config.mk
       @@ -4,6 +4,9 @@
        PREFIX = /usr/local
        MANPREFIX = ${PREFIX}/man
        
       +# compiler and linker
       +#CC = cc
       +
        GITINC = /usr/local/include
        GITLIB = /usr/local/lib
        
       @@ -23,6 +26,7 @@ LDFLAGS = -s ${LIBS}
        #CFLAGS = -static -O2 -std=c99 ${INCS}
        #LDFLAGS = -static -s ${LIBS}
        
       -CPPFLAGS= -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE ${INCS}
       -# compiler and linker
       -#CC = cc
       +CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE ${INCS}
       +
       +# OpenBSD 5.9+: use pledge(2)
       +#CPPFLAGS += -DUSE_PLEDGE
   DIR diff --git a/stagit-index.c b/stagit-index.c
       @@ -23,6 +23,14 @@ static char description[255] = "Repositories";
        static char *name = "";
        static char owner[255];
        
       +#ifndef USE_PLEDGE
       +int
       +pledge(const char *promises, const char *paths[])
       +{
       +        return 0;
       +}
       +#endif
       +
        /* Escape characters below as HTML 2.0 / XML 1.0. */
        void
        xmlencode(FILE *fp, const char *s, size_t len)
       @@ -154,6 +162,9 @@ main(int argc, char *argv[])
                char path[PATH_MAX], repodirabs[PATH_MAX + 1];
                int i, ret = 0;
        
       +        if (pledge("stdio rpath", NULL) == -1)
       +                err(1, "pledge");
       +
                if (argc < 2) {
                        fprintf(stderr, "%s [repodir...]\n", argv[0]);
                        return 1;
   DIR diff --git a/stagit.c b/stagit.c
       @@ -64,6 +64,14 @@ static char lastoidstr[GIT_OID_HEXSZ + 2]; /* id + newline + nul byte */
        static FILE *rcachefp, *wcachefp;
        static const char *cachefile;
        
       +#ifndef USE_PLEDGE
       +int
       +pledge(const char *promises, const char *paths[])
       +{
       +        return 0;
       +}
       +#endif
       +
        void
        deltainfo_free(struct deltainfo *di)
        {
       @@ -1033,6 +1041,9 @@ main(int argc, char *argv[])
                size_t n;
                int i, fd;
        
       +        if (pledge("stdio rpath wpath cpath", NULL) == -1)
       +                err(1, "pledge");
       +
                for (i = 1; i < argc; i++) {
                        if (argv[i][0] != '-') {
                                if (repodir)