Improve private function documentation.
Write extracted files using O_EXCL.

A malicious archive could use a symlink to overwrite arbitrary
filesystem locations. Write files using O_EXCL so that this is
not possible.
Sanitize directory paths and do not allow '..'

Archived files with '..' in the directory path might be used to escape
the directory being extracted into and overwrite arbitrary files.