summaryrefslogtreecommitdiff
path: root/runit/chpst.c
diff options
context:
space:
mode:
authorDenys Vlasenko2011-09-16 11:54:13 +0200
committerDenys Vlasenko2011-09-16 11:54:13 +0200
commitc74a79f28824b634d621c572c079614a8c227479 (patch)
tree529cb126b52f0e29c9cf79587792b0485c7a3368 /runit/chpst.c
parentd18ef6c9f6f5c94f2a65a6ab6ae3776711cb2877 (diff)
downloadbusybox-c74a79f28824b634d621c572c079614a8c227479.zip
busybox-c74a79f28824b634d621c572c079614a8c227479.tar.gz
chpst: move misplaced comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'runit/chpst.c')
-rw-r--r--runit/chpst.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/runit/chpst.c b/runit/chpst.c
index 44c21a2..9b8c99b 100644
--- a/runit/chpst.c
+++ b/runit/chpst.c
@@ -405,18 +405,17 @@ int chpst_main(int argc UNUSED_PARAM, char **argv)
if (opt & OPT_e)
edir(env_dir);
- if (opt & (OPT_u|OPT_U)) {
+ if (opt & (OPT_u|OPT_U))
xget_uidgid(&ugid, set_user);
- }
+ // chrooted jail must have /etc/passwd if we move this after chroot.
+ // OTOH chroot fails for non-roots.
+ // Solution: cache uid/gid before chroot, apply uid/gid after.
if (opt & OPT_U) {
xsetenv("GID", utoa(ugid.gid));
xsetenv("UID", utoa(ugid.uid));
}
- // chrooted jail must have /etc/passwd if we move this after chroot.
- // OTOH chroot fails for non-roots.
- // Solution: cache uid/gid before chroot, apply uid/gid after.
if (opt & OPT_root) {
xchdir(root);
xchroot(".");