diff options
author | Eric S. Raymond <esr@thyrsus.com> | 1998-07-29 21:32:28 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 1998-07-29 21:32:28 +0000 |
commit | 5a4137eff4dec7d3e2d9de804847f63ba97289c7 (patch) | |
tree | 7abe2b1d54a5bd646e5d93273290294de10e0f47 /env.c | |
parent | c2efa945dfd7105849c17cffa3210f9d004545f2 (diff) | |
download | fetchmail-5a4137eff4dec7d3e2d9de804847f63ba97289c7.tar.gz fetchmail-5a4137eff4dec7d3e2d9de804847f63ba97289c7.tar.bz2 fetchmail-5a4137eff4dec7d3e2d9de804847f63ba97289c7.zip |
Gunther Leber's fix.
svn path=/trunk/; revision=2027
Diffstat (limited to 'env.c')
-rw-r--r-- | env.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -62,6 +62,8 @@ void envquery(int argc, char **argv) exit(PS_IOERR); } #ifdef HAVE_GETHOSTBYNAME + /* if we got a . in the hostname assume it is a FQDN */ + if (strchr(tmpbuf, '.') == NULL) { struct hostent *hp; @@ -73,14 +75,20 @@ void envquery(int argc, char **argv) fprintf(stderr, "gethostbyname failed for %s\n", tmpbuf); exit(PS_DNS); } - strcpy(tmpbuf, hp->h_name); + fetchmailhost = xstrdup(hp->h_name); } + else #endif /* HAVE_GETHOSTBYNAME */ - fetchmailhost = xstrdup(tmpbuf); + fetchmailhost = xstrdup(tmpbuf); #define RCFILE_NAME ".fetchmailrc" rcfile = (char *) xmalloc(strlen(home)+strlen(RCFILE_NAME)+2); - strcpy(rcfile, home); + /* avoid //.fetchmailrc */ + if (strcmp(home, "/") != 0) { + strcpy(rcfile, home); + } else { + *rcfile = '\0'; + } strcat(rcfile, "/"); strcat(rcfile, RCFILE_NAME); } |