From 0d65048dd98bc1b408fe9a2f3e6157c28a1c4c7d Mon Sep 17 00:00:00 2001 From: Nathan Straz Date: Thu, 8 Oct 2009 08:52:33 -0400 Subject: 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. --- qarsh.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'qarsh.c') 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); } -- cgit