aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormaximilian attems <max@stro.at>2008-07-13 12:22:16 +0200
committermaximilian attems <max@stro.at>2008-07-13 12:34:36 +0200
commit9500dd5c8890b190c4e1267848e1db20fcc54fee (patch)
tree35fa0bb09bbb0d44ef0484367bc0701bfe506133
parent6b76f2cbacd3ad94c8ce9dfaf4a6fa4484636f84 (diff)
downloadklibc-9500dd5c8890b190c4e1267848e1db20fcc54fee.tar.gz
[klibc] chroot: Fix expected behaviourklibc-1.5.13
/usr/lib/klibc/bin/chroot / sh execve: No such file or directory /usr/lib/klibc/bin/chroot / /bin/pwd /home/max ./src/klibc/usr/utils/static/chroot / pwd / Cc: Colin Watson <cjwatson@ubuntu.com> Signed-off-by: maximilian attems <max@stro.at>
-rw-r--r--usr/utils/chroot.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/usr/utils/chroot.c b/usr/utils/chroot.c
index e3e67919df5e1..bc1b94f167c5c 100644
--- a/usr/utils/chroot.c
+++ b/usr/utils/chroot.c
@@ -16,8 +16,13 @@ int main(int argc, char *argv[], char *envp[])
return 1;
}
- if (execve(argv[2], argv + 2, envp) == -1) {
- perror("execve");
+ if (chdir("/") == -1) {
+ perror("chdir");
+ return 1;
+ }
+
+ if (execvp(argv[2], argv + 2) == -1) {
+ perror("execvp");
return 1;
}