stagit

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

commit
3c07e52f98b0f49250c3de026b31202b426eb45a
parent
f53f481b3f02431b151ae9953998d7c7b3138585
Author
Hiltjo Posthuma <hiltjo@codemadness.org>
Date
2018-03-26 18:08
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

M stagit.c 13 ++++++++-----

1 files changed, 8 insertions, 5 deletions


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

@@ -1027,9 +1027,6 @@ main(int argc, char *argv[])
 1027  1027 	size_t n;
 1028  1028 	int i, fd;
 1029  1029 
 1030    -1 	if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
 1031    -1 		err(1, "pledge");
 1032    -1 
 1033  1030 	for (i = 1; i < argc; i++) {
 1034  1031 		if (argv[i][0] != '-') {
 1035  1032 			if (repodir)
@@ -1052,8 +1049,6 @@ main(int argc, char *argv[])
 1052  1049 				usage(argv[0]);
 1053  1050 		}
 1054  1051 	}
 1055    -1 	if (!cachefile && pledge("stdio rpath wpath cpath", NULL) == -1)
 1056    -1 		err(1, "pledge");
 1057  1052 	if (!repodir)
 1058  1053 		usage(argv[0]);
 1059  1054 
@@ -1062,6 +1057,14 @@ main(int argc, char *argv[])
 1062  1057 
 1063  1058 	git_libgit2_init();
 1064  1059 
   -1  1060 	if (cachefile) {
   -1  1061 		if (pledge("stdio rpath wpath cpath fattr", NULL) == -1)
   -1  1062 			err(1, "pledge");
   -1  1063 	} else {
   -1  1064 		if (pledge("stdio rpath wpath cpath", NULL) == -1)
   -1  1065 			err(1, "pledge");
   -1  1066 	}
   -1  1067 
 1065  1068 	if (git_repository_open_ext(&repo, repodir,
 1066  1069 		GIT_REPOSITORY_OPEN_NO_SEARCH, NULL) < 0) {
 1067  1070 		e = giterr_last();