Commit c6e5b671 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

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.
parent e7050f97
Loading
Loading
Loading
Loading
+14 −12
Original line number Diff line number Diff line
@@ -111,7 +111,12 @@ 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)
    }
    else {
      struct passwd *pw;
      pw= getpwuid(geteuid());
      if (pw) {
@@ -122,13 +127,10 @@ int Curl_parsenetrc(char *host,
#endif
      }
#endif
    }

    if(!home) {
      home = curl_getenv("HOME"); /* portable environment reader */
    if(!home)
      return -1;
      home_alloc = TRUE;
    }

    netrcfile = curl_maprintf("%s%s%s", home, DIR_CHAR, NETRC);
    if(!netrcfile) {