libc: try to skip memcpy in _gettemp
(cherry picked from commit b22fdf45ff8ef1d1f9a6c28f1d7f59ca4b012da6)