SpawningKit HandshakePrepare: tighten permissions and increase error checking
SpawningKit HandshakePrepare: tighten permissions and increase error checking

These changes do not solve any concrete problems, but they may help in
detecting bugs or security attacks in the future.

phusion/passenger,phusion/passenger,phusion/passenger,phusion/passenger,phusion/passenger,phusion/passenger,phusion/passenger,phusion/passenger