Modifying map to avoid using the heap and errno.