Changes from pr2:

* Slightly better relative path handling code.

Changes from pr1:

* Fixed a security hole in open() by making it sysopen() and dodging
  the issue.
