Commit 8de6262f authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Removing files and directories needs Jail attention

Add VJ_unlink() and VJ_rmdir() to do so.
parent e4fb2a94
......@@ -147,6 +147,8 @@ void VJ_subproc(enum jail_subproc_e);
int VJ_make_workdir(const char *);
int VJ_make_subdir(const char *, const char *, struct vsb *);
void VJ_fix_fd(int, enum jail_fixfd_e);
void VJ_unlink(const char *);
void VJ_rmdir(const char *);
extern const struct jail_tech jail_tech_unix;
extern const struct jail_tech jail_tech_solaris;
......
......@@ -196,6 +196,28 @@ VJ_make_subdir(const char *dname, const char *what, struct vsb *vsb)
return (0);
}
void
VJ_unlink(const char *fname)
{
VJ_master(JAIL_MASTER_FILE);
if (unlink(fname)) {
fprintf(stderr, "Could not delete '%s': %s\n",
fname, strerror(errno));
}
VJ_master(JAIL_MASTER_LOW);
}
void
VJ_rmdir(const char *dname)
{
VJ_master(JAIL_MASTER_FILE);
if (rmdir(dname)) {
fprintf(stderr, "Could not rmdir '%s': %s\n",
dname, strerror(errno));
}
VJ_master(JAIL_MASTER_LOW);
}
void
VJ_fix_fd(int fd, enum jail_fixfd_e what)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment