start++;
}
if (start >= size) {
- ERROR("bad script interp (%s)", path);
+ ERROR("bad script interp (%s)\n", path);
return -1;
}
int stop = start + 1;
stop++;
}
if (stop >= size || (stop-start) > PATH_MAX) {
- ERROR("bad script interp (%s)", path);
+ ERROR("bad script interp (%s)\n", path);
return -1;
}
char buf[PATH_MAX];
return 0;
if (ret)
- ERROR("mkdir failed on %s: %s\n", dir, strerror(errno));
+ ERROR("mkdir(%s, %d) failed: %s\n", dir, mask, strerror(errno));
return ret;
}
snprintf(new, sizeof(new), "%s%s", root, path);
fd = creat(new, 0644);
if (fd == -1) {
- ERROR("failed to create %s: %s\n", new, strerror(errno));
+ ERROR("creat(%s) failed: %s\n", new, strerror(errno));
return -1;
}
close(fd);
return -1;
}
- DEBUG("mount -B %s %s\n", path, new);
+ DEBUG("mount -B %s %s (%s)\n", path, new, readonly?"ro":"rw");
return 0;
}
{
char jail_root[] = "/tmp/ujail-XXXXXX";
if (mkdtemp(jail_root) == NULL) {
- ERROR("mkdtemp(jail_root) failed: %s\n", strerror(errno));
+ ERROR("mkdtemp(%s) failed: %s\n", jail_root, strerror(errno));
return -1;
}
}
if (chdir(jail_root)) {
- ERROR("failed to chdir() in the jail root\n");
+ ERROR("chdir(%s) (jail_root) failed: %s\n", jail_root, strerror(errno));
return -1;
}
mkdir(dirbuf, 0755);
if (pivot_root(jail_root, dirbuf) == -1) {
- ERROR("pivot_root failed: %s\n", strerror(errno));
+ ERROR("pivot_root(%s, %s) failed: %s\n", jail_root, dirbuf, strerror(errno));
return -1;
}
if (chdir("/")) {
- ERROR("chdir(/) failed: %s\n", strerror(errno));
+ ERROR("chdir(/) (after pivot_root) failed: %s\n", strerror(errno));
return -1;
}