summaryrefslogtreecommitdiffstats
path: root/qarsh.c
diff options
context:
space:
mode:
authorNathan Straz <nstraz@redhat.com>2009-10-08 08:52:33 -0400
committerNathan Straz <nstraz@redhat.com>2009-10-08 08:52:33 -0400
commit0d65048dd98bc1b408fe9a2f3e6157c28a1c4c7d (patch)
tree7b904e2111577c647a848c8b8490d62ff11b35c3 /qarsh.c
parentf5e388528bd8f1b6ca10a43c0f32f3fd1d3dfabe (diff)
downloadqarsh-0d65048dd98bc1b408fe9a2f3e6157c28a1c4c7d.tar.gz
qarsh-0d65048dd98bc1b408fe9a2f3e6157c28a1c4c7d.tar.xz
qarsh-0d65048dd98bc1b408fe9a2f3e6157c28a1c4c7d.zip
Only look up local username if remote not specified
In rare cases the getpwuid() call will fail because of a YP or LDAP timeout. If we're not using the local username we shouldn't even bother looking it up.
Diffstat (limited to 'qarsh.c')
-rw-r--r--qarsh.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/qarsh.c b/qarsh.c
index a8bb7ab..4fa8687 100644
--- a/qarsh.c
+++ b/qarsh.c
@@ -483,11 +483,11 @@ again:
*sp = '\0';
}
}
- if (!(pw = getpwuid(getuid()))) {
- fprintf(stderr, "qarsh: unknown user id.\n");
- exit(1);
- }
if (remuser == NULL) {
+ if (!(pw = getpwuid(getuid()))) {
+ fprintf(stderr, "qarsh: can not look up local username.\n");
+ exit(1);
+ }
remuser = strdup(pw->pw_name);
}