stagit-gopher

[fork] gopher git frontend
Log | Files | Refs | README | LICENSE

commit 4af56862f25af790ce711ffcfefb792b42042b0d
parent f2bd82599fbf7d3d9c2f7682ee0f09318aa1e798
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Fri, 25 May 2018 18:42:35 +0200

assume OpenBSD 5.9+, always try pledge(2) on OpenBSD

Diffstat:
Mconfig.mk | 3---
Mstagit-gopher-index.c | 6++----
Mstagit-gopher.c | 6++----
3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/config.mk b/config.mk @@ -27,6 +27,3 @@ LDFLAGS = -s ${LIBS} #LDFLAGS = -static -s ${LIBS} CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE ${INCS} - -# OpenBSD 5.9+: use pledge(2) -#CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE -DUSE_PLEDGE ${INCS} diff --git a/stagit-gopher-index.c b/stagit-gopher-index.c @@ -22,10 +22,6 @@ static const char *relpath = ""; static char description[255] = "Repositories"; static char *name = ""; -#ifndef USE_PLEDGE -#define pledge(p1,p2) 0 -#endif - /* format `len' columns of characters. If string is shorter pad the rest * with characters `pad`. */ int @@ -224,8 +220,10 @@ main(int argc, char *argv[]) git_libgit2_init(); +#ifdef __OpenBSD__ if (pledge("stdio rpath", NULL) == -1) err(1, "pledge"); +#endif for (i = 1; i < argc; i++) { if (argv[i][0] == '-') { diff --git a/stagit-gopher.c b/stagit-gopher.c @@ -67,10 +67,6 @@ static char lastoidstr[GIT_OID_HEXSZ + 2]; /* id + newline + nul byte */ static FILE *rcachefp, *wcachefp; static const char *cachefile; -#ifndef USE_PLEDGE -#define pledge(p1,p2) 0 -#endif - /* format `len' columns of characters. If string is shorter pad the rest * with characters `pad`. */ int @@ -1150,6 +1146,7 @@ main(int argc, char *argv[]) git_libgit2_init(); +#ifdef __OpenBSD__ if (cachefile) { if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) err(1, "pledge"); @@ -1157,6 +1154,7 @@ main(int argc, char *argv[]) if (pledge("stdio rpath wpath cpath", NULL) == -1) err(1, "pledge"); } +#endif if (git_repository_open_ext(&repo, repodir, GIT_REPOSITORY_OPEN_NO_SEARCH, NULL) < 0) {