stagit-gopher

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

commit c1b5e802f0d0c349faf8d4e6b6988dcfdc574488
parent ec19160fa44ca478dd7e319eea8ee1ee1a0973e2
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Mon, 26 Mar 2018 20:11:56 +0200

pledge after git_libgit2_init

this is because libgit uses curl which uses some initialization
checks, namely an IPv6 check which creates a socket.

Diffstat:
Mstagit-gopher.c | 13++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/stagit-gopher.c b/stagit-gopher.c @@ -1110,9 +1110,6 @@ main(int argc, char *argv[]) size_t n; int i, fd; - if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) - err(1, "pledge"); - setlocale(LC_CTYPE, ""); for (i = 1; i < argc; i++) { @@ -1141,8 +1138,6 @@ main(int argc, char *argv[]) usage(argv[0]); } } - if (!cachefile && pledge("stdio rpath wpath cpath", NULL) == -1) - err(1, "pledge"); if (!repodir) usage(argv[0]); @@ -1151,6 +1146,14 @@ main(int argc, char *argv[]) git_libgit2_init(); + if (cachefile) { + if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) + err(1, "pledge"); + } else { + if (pledge("stdio rpath wpath cpath", NULL) == -1) + err(1, "pledge"); + } + if (git_repository_open_ext(&repo, repodir, GIT_REPOSITORY_OPEN_NO_SEARCH, NULL) < 0) { e = giterr_last();