From b5092167190004004d01ad01dd180ded079a0457 Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 17 Dec 2012 23:03:41 +0000 Subject: pull user home directory via getenv or getpwuid and stash it so we don't need to do this everytime; with Tiago Cunha --- kbfunc.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'kbfunc.c') diff --git a/kbfunc.c b/kbfunc.c index f58982b..a134999 100644 --- a/kbfunc.c +++ b/kbfunc.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: kbfunc.c,v 1.69 2012/12/17 14:32:39 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.70 2012/12/17 23:03:41 okan Exp $ */ #include @@ -324,16 +324,13 @@ kbfunc_ssh(struct client_ctx *cc, union arg *arg) struct menu *mi; struct menu_q menuq; FILE *fp; - char *buf, *lbuf, *p, *home; + char *buf, *lbuf, *p; char hostbuf[MAXHOSTNAMELEN], filename[MAXPATHLEN]; char cmd[256]; int l; size_t len; - if ((home = getenv("HOME")) == NULL) - return; - - l = snprintf(filename, sizeof(filename), "%s/%s", home, KNOWN_HOSTS); + l = snprintf(filename, sizeof(filename), "%s/%s", homedir, KNOWN_HOSTS); if (l == -1 || l >= sizeof(filename)) return; -- cgit v1.2.3-2-gb3c3