aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordlezcano <dlezcano>2008-10-08 14:15:58 +0000
committerdlezcano <dlezcano>2008-10-08 14:15:58 +0000
commitc3f0a28cecdc0fc1b4301e1fc44e58d4f1d128fd (patch)
treea07c1c0cc39be9ee3423b39c19279ab601d114e7
parentRemoved useless opentty function and moved the sighandler restore to the righ... (diff)
downloadlxc-c3f0a28cecdc0fc1b4301e1fc44e58d4f1d128fd.tar.gz
lxc-c3f0a28cecdc0fc1b4301e1fc44e58d4f1d128fd.tar.bz2
lxc-c3f0a28cecdc0fc1b4301e1fc44e58d4f1d128fd.zip
Removed useless readlink before chrooting
-rw-r--r--src/lxc/lxc_conf.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/lxc/lxc_conf.c b/src/lxc/lxc_conf.c
index 08c6cd6..f8e1d0c 100644
--- a/src/lxc/lxc_conf.c
+++ b/src/lxc/lxc_conf.c
@@ -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(chrt)) {
- lxc_log_syserror("failed to set chroot %s", path);
- return -1;
- }
+ if (chroot(path)) {
+ 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;