assume OpenBSD 5.9+, always try pledge(2) on OpenBSD
3 files changed, 4 insertions(+), 11 deletions(-) | |||
---|---|---|---|
M | config.mk | +0 | -3 |
M | stagit-index.c | +2 | -4 |
M | stagit.c | +2 | -4 |
1@@ -27,6 +27,3 @@ LDFLAGS = -s ${LIBS}
2 #LDFLAGS = -static -s ${LIBS}
3
4 CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE ${INCS}
5-
6-# OpenBSD 5.9+: use pledge(2)
7-#CPPFLAGS = -D_XOPEN_SOURCE=700 -D_DEFAULT_SOURCE -D_BSD_SOURCE -DUSE_PLEDGE ${INCS}
M · stagit-index.c
+2, -4 1@@ -21,10 +21,6 @@ static char description[255] = "Repositories";
2 static char *name = "";
3 static char owner[255];
4
5-#ifndef USE_PLEDGE
6-#define pledge(p1,p2) 0
7-#endif
8-
9 void
10 joinpath(char *buf, size_t bufsiz, const char *path, const char *path2)
11 {
12@@ -164,8 +160,10 @@ main(int argc, char *argv[])
13
14 git_libgit2_init();
15
16+#ifdef __OpenBSD__
17 if (pledge("stdio rpath", NULL) == -1)
18 err(1, "pledge");
19+#endif
20
21 writeheader(stdout);
22
M · stagit.c
+2, -4 1@@ -65,10 +65,6 @@ static char lastoidstr[GIT_OID_HEXSZ + 2]; /* id + newline + nul byte */
2 static FILE *rcachefp, *wcachefp;
3 static const char *cachefile;
4
5-#ifndef USE_PLEDGE
6-#define pledge(p1,p2) 0
7-#endif
8-
9 void
10 joinpath(char *buf, size_t bufsiz, const char *path, const char *path2)
11 {
12@@ -1057,6 +1053,7 @@ main(int argc, char *argv[])
13
14 git_libgit2_init();
15
16+#ifdef __OpenBSD__
17 if (cachefile) {
18 if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
19 err(1, "pledge");
20@@ -1064,6 +1061,7 @@ main(int argc, char *argv[])
21 if (pledge("stdio rpath wpath cpath", NULL) == -1)
22 err(1, "pledge");
23 }
24+#endif
25
26 if (git_repository_open_ext(&repo, repodir,
27 GIT_REPOSITORY_OPEN_NO_SEARCH, NULL) < 0) {