make getpwnam thread safe