replace getpwnam and getgrgid with thread safe getpwnam_r and getgrgid_r