From: Denys Vlasenko Date: Fri, 16 Sep 2011 09:54:13 +0000 (+0200) Subject: chpst: move misplaced comment X-Git-Tag: 1_20_0~226 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c74a79f28824b634d621c572c079614a8c227479;p=oweals%2Fbusybox.git chpst: move misplaced comment Signed-off-by: Denys Vlasenko --- diff --git a/runit/chpst.c b/runit/chpst.c index 44c21a2a4..9b8c99bdd 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(".");