2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 10:59:35 +00:00

Removed useless readlink before chrooting

This commit is contained in:
dlezcano
2008-10-08 14:15:58 +00:00
parent 536b97f0c8
commit c3f0a28cec

View File

@@ -630,21 +630,18 @@ static int setup_utsname(const char *name)
static int setup_rootfs(const char *name)
{
char path[MAXPATHLEN], chrt[MAXPATHLEN];
char path[MAXPATHLEN];
snprintf(path, MAXPATHLEN, LXCPATH "/%s/rootfs", name);
if (readlink(path, chrt, MAXPATHLEN) > 0) {
if (chroot(path)) {
lxc_log_syserror("failed to set chroot %s", path);
return -1;
}
if (chroot(chrt)) {
lxc_log_syserror("failed to set chroot %s", path);
return -1;
}
if (chdir(getenv("HOME")) && chdir("/")) {
lxc_log_syserror("failed to change to home directory");
return -1;
}
if (chdir(getenv("HOME")) && chdir("/")) {
lxc_log_syserror("failed to change to home directory");
return -1;
}
return 0;