Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2013-05-21 19:13:32 +0400
committerBryan Drewery <bryan@shatow.net>2013-05-21 19:13:32 +0400
commit1c5e51781c7ab4bd328c543194cb74129f3c60a6 (patch)
tree5b7cc8469468a9f9815e05ff15d6c1caa8ac5b23 /src/libexec
parent73074d33993f75afcaed0ded2784337644613be4 (diff)
make_index: Attach to the jail when executing
Diffstat (limited to 'src/libexec')
-rw-r--r--src/libexec/poudriere/Makefile2
-rw-r--r--src/libexec/poudriere/make_index.c20
2 files changed, 18 insertions, 4 deletions
diff --git a/src/libexec/poudriere/Makefile b/src/libexec/poudriere/Makefile
index 4124700a..a4600669 100644
--- a/src/libexec/poudriere/Makefile
+++ b/src/libexec/poudriere/Makefile
@@ -9,7 +9,7 @@ dirwatch: dirwatch.c
${CC} -Wall -Werror ${CFLAGS} dirwatch.c -o dirwatch
make_index: make_index.c
- ${CC} -Wall -Werror ${CFLAGS} make_index.c -o make_index -lsbuf
+ ${CC} -Wall -Werror ${CFLAGS} -ljail make_index.c -o make_index -lsbuf
install: dirwatch make_index dirempty
mkdir -p ${PREFIX}/libexec/poudriere
diff --git a/src/libexec/poudriere/make_index.c b/src/libexec/poudriere/make_index.c
index 55eebd42..b16f0205 100644
--- a/src/libexec/poudriere/make_index.c
+++ b/src/libexec/poudriere/make_index.c
@@ -21,11 +21,14 @@
#include <sys/types.h>
#include <sys/sbuf.h>
#include <sys/queue.h>
+#include <sys/param.h>
+#include <sys/jail.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <err.h>
+#include <jail.h>
/*
* A field, it helps defining the list of fields such as depends
@@ -417,13 +420,24 @@ int
main(int argc, char **argv)
{
Ports ports;
+ int jid;
+ const char *jail_str;
- if (argc < 3)
+ if (argc < 4)
usage();
/* NOTREACHED */
- ports_read(&ports, argv[1]);
- ports_write(&ports, argv[2]);
+ jail_str = argv[1];
+
+ jid = jail_getid(jail_str);
+ if (jid < 0)
+ errx(1, "%s", jail_errmsg);
+
+ if (jail_attach(jid) == -1)
+ err(1, "jail_attach(%s)", jail_str);
+
+ ports_read(&ports, argv[2]);
+ ports_write(&ports, argv[3]);
ports_free(&ports);
return 0;