diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2018-03-26 20:08:19 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2018-03-26 20:08:19 +0200 |
commit | 3c07e52f98b0f49250c3de026b31202b426eb45a (patch) | |
tree | dcc70314d055cbe7c8115fe4e6d64432236294ab | |
parent | f53f481b3f02431b151ae9953998d7c7b3138585 (diff) | |
download | stagit-fork-3c07e52f98b0f49250c3de026b31202b426eb45a.zip |
pledge after git_libgit2_init
this is because libgit uses curl which uses some initialization
checks, namely an IPv6 check which creates a socket.
-rw-r--r-- | stagit.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -1027,9 +1027,6 @@ main(int argc, char *argv[]) size_t n; int i, fd; - if (pledge("stdio rpath wpath cpath fattr", NULL) == -1) - err(1, "pledge"); - for (i = 1; i < argc; i++) { if (argv[i][0] != '-') { if (repodir) @@ -1052,8 +1049,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]); @@ -1062,6 +1057,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(); |