Issue #1: Fix mode parameter to open().

Instead of using constants which may or may not be defined, just use 0666.
The process's umask will be applied in the open() call, which on most systems
will produce 0644.