Use umask() to set file and UNIX socket permissions without race conditions.