dirname(3) can modify content.
Fix symlink during fetch.
Stop using of mkstemp for regular files.
Umask is meaningless for mkstemp.
Fixes.