netrc: fixed thread safety problem by using getpwuid_r if available

The old way using getpwuid could cause problems in programs that enable
reading from netrc files simultaneously in multiple threads.

Reported-by: David Woodhouse