daemon_switch_user: Improve portablility