git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #11602 from zimbatm/stricter-chroot-user

build-fhs-userenv: don't leak file descriptors

commit8ec4b45dbd2992e78cec15361acff4cfa8395c6b authorNikolay Amiantov <ab@fmap.me> dateFri 11 Dec 2015, 00:40 (11 years ago) parentb3983719b33ec1
1 file changed+2−2
pkgs/build-support/build-fhs-userenv/chroot-user.rb+2−2
pkgs/build-support/build-fhs-userenv/chroot-user.rb+2−2
@@ -140,10 +140,10 @@ if $cpid == 0
140140 link_swdir.call swdir, Pathname.new('')
141141
142142 # New environment
143− ENV.replace(Hash[ envvars.map { |x| [x, ENV[x]] } ])
143+ new_env = Hash[ envvars.map { |x| [x, ENV[x]] } ]
144144
145145 # Finally, exec!
146− exec *execp
146+ exec(new_env, *execp, close_others: true, unsetenv_others: true)
147147end
148148
149149# Wait for a child. If we catch a signal, resend it to child and continue