aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-02-19 09:22:00 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-02-19 09:22:00 +0000
commitc6e5b6719785943e2225cae1cc70db61dfb57ede (patch)
tree9ed26c26f5ce57ba0cd400869b53f14b1d017376 /lib
parente7050f97c49a451671165b6e63f926072d5d118b (diff)
Doug Porter's patch that changes the order of preferences on how to find the
default netrc file. We now read and uses HOME _before_ we use getpwuid() to better allow users to move around HOME to use different .netrc files without having to rely on even blacker magic.
Diffstat (limited to 'lib')
-rw-r--r--lib/netrc.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/netrc.c b/lib/netrc.c
index 059ccdabc..c43fc9fe1 100644
--- a/lib/netrc.c
+++ b/lib/netrc.c
@@ -111,25 +111,27 @@ int Curl_parsenetrc(char *host,
}
#endif /* CURLDEBUG */
if(!netrcfile) {
+ home = curl_getenv("HOME"); /* portable environment reader */
+ if(home) {
+ home_alloc = TRUE;
#if defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
- struct passwd *pw;
- pw= getpwuid(geteuid());
- if (pw) {
+ }
+ else {
+ struct passwd *pw;
+ pw= getpwuid(geteuid());
+ if (pw) {
#ifdef VMS
- home = decc$translate_vms(pw->pw_dir);
+ home = decc$translate_vms(pw->pw_dir);
#else
- home = pw->pw_dir;
+ home = pw->pw_dir;
#endif
- }
+ }
#endif
-
- if(!home) {
- home = curl_getenv("HOME"); /* portable environment reader */
- if(!home)
- return -1;
- home_alloc = TRUE;
}
+ if(!home)
+ return -1;
+
netrcfile = curl_maprintf("%s%s%s", home, DIR_CHAR, NETRC);
if(!netrcfile) {
if(home_alloc)