stagit

static git page generator  https://git.ce9e.org
git clone https://git.ce9e.org/stagit.git

commit
187daac42007c87e6af9317a20446e3b81907f63
parent
c7f158c58c338961b1a1a91f41a5dade42853dec
Author
Hiltjo Posthuma <hiltjo@codemadness.org>
Date
2018-05-25 16:43
assume OpenBSD 5.9+, always try pledge(2) on OpenBSD

Diffstat

M config.mk 3 ---
M stagit-index.c 6 ++----
M stagit.c 6 ++----

3 files changed, 4 insertions, 11 deletions


diff --git a/config.mk b/config.mk

@@ -27,6 +27,3 @@ LDFLAGS = -s ${LIBS}
   27    27 #LDFLAGS = -static -s ${LIBS}
   28    28 
   29    29 CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE ${INCS}
   30    -1 
   31    -1 # OpenBSD 5.9+: use pledge(2)
   32    -1 #CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE -DUSE_PLEDGE ${INCS}

diff --git a/stagit-index.c b/stagit-index.c

@@ -21,10 +21,6 @@ static char description[255] = "Repositories";
   21    21 static char *name = "";
   22    22 static char owner[255];
   23    23 
   24    -1 #ifndef USE_PLEDGE
   25    -1 #define pledge(p1,p2) 0
   26    -1 #endif
   27    -1 
   28    24 void
   29    25 joinpath(char *buf, size_t bufsiz, const char *path, const char *path2)
   30    26 {
@@ -164,8 +160,10 @@ main(int argc, char *argv[])
  164   160 
  165   161 	git_libgit2_init();
  166   162 
   -1   163 #ifdef __OpenBSD__
  167   164 	if (pledge("stdio rpath", NULL) == -1)
  168   165 		err(1, "pledge");
   -1   166 #endif
  169   167 
  170   168 	writeheader(stdout);
  171   169 

diff --git a/stagit.c b/stagit.c

@@ -65,10 +65,6 @@ static char lastoidstr[GIT_OID_HEXSZ + 2]; /* id + newline + nul byte */
   65    65 static FILE *rcachefp, *wcachefp;
   66    66 static const char *cachefile;
   67    67 
   68    -1 #ifndef USE_PLEDGE
   69    -1 #define pledge(p1,p2) 0
   70    -1 #endif
   71    -1 
   72    68 void
   73    69 joinpath(char *buf, size_t bufsiz, const char *path, const char *path2)
   74    70 {
@@ -1057,6 +1053,7 @@ main(int argc, char *argv[])
 1057  1053 
 1058  1054 	git_libgit2_init();
 1059  1055 
   -1  1056 #ifdef __OpenBSD__
 1060  1057 	if (cachefile) {
 1061  1058 		if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
 1062  1059 			err(1, "pledge");
@@ -1064,6 +1061,7 @@ main(int argc, char *argv[])
 1064  1061 		if (pledge("stdio rpath wpath cpath", NULL) == -1)
 1065  1062 			err(1, "pledge");
 1066  1063 	}
   -1  1064 #endif
 1067  1065 
 1068  1066 	if (git_repository_open_ext(&repo, repodir,
 1069  1067 		GIT_REPOSITORY_OPEN_NO_SEARCH, NULL) < 0) {