System.chroot: Change working directory to new root.

To avoid jail escapes, the current working directory is changed
to the new root on success.

Also adds protection against EINTR failure.
Image.Colortable: Fixed potential division by zero.