aboutsummaryrefslogtreecommitdiffstats
path: root/env.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1999-04-07 22:57:47 +0000
committerEric S. Raymond <esr@thyrsus.com>1999-04-07 22:57:47 +0000
commit66900c733ccef6a01b8fc6d7ca9f5f9adac7656a (patch)
treef8d21da2f215bd13dc3d8473209b287975535406 /env.c
parent69b56c86fb2139aeba8d842f3f158aa4a88d9a5e (diff)
downloadfetchmail-66900c733ccef6a01b8fc6d7ca9f5f9adac7656a.tar.gz
fetchmail-66900c733ccef6a01b8fc6d7ca9f5f9adac7656a.tar.bz2
fetchmail-66900c733ccef6a01b8fc6d7ca9f5f9adac7656a.zip
First round of post-5.0.0 buglets.
svn path=/trunk/; revision=2430
Diffstat (limited to 'env.c')
-rw-r--r--env.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/env.c b/env.c
index ad915263..dd6755d4 100644
--- a/env.c
+++ b/env.c
@@ -40,23 +40,22 @@ void envquery(int argc, char **argv)
else
program_name = argv[0];
- if ((user = getenv("USER")) == (char *)NULL)
- user = getenv("LOGNAME");
-
- if ((user == (char *)NULL) || (home = getenv("HOME")) == (char *)NULL)
+ if ((pw = getpwuid(getuid())) != NULL)
{
- if ((pw = getpwuid(getuid())) != NULL)
- {
- user = pw->pw_name;
- home = pw->pw_dir;
- }
- else
- {
- fprintf(stderr,
- _("%s: can't find your name and home directory!\n"),
- program_name);
- exit(PS_UNDEFINED);
- }
+ user = pw->pw_name;
+ home = pw->pw_dir;
+ }
+ else if ((home = getenv("HOME")))
+ {
+ if ((user = getenv("LOGNAME")) == (char *)NULL || user[0] == '\0')
+ user = getenv("USER");
+ }
+ else
+ {
+ fprintf(stderr,
+ _("%s: can't find your name and home directory!\n"),
+ program_name);
+ exit(PS_UNDEFINED);
}
#define RCFILE_NAME ".fetchmailrc"