pull user home directory via getenv or getpwuid and stash it so we don't

need to do this everytime; with Tiago Cunha
This commit is contained in:
okan
2012-12-17 23:03:41 +00:00
parent fe44d1dfce
commit 75f65f399e
4 changed files with 15 additions and 10 deletions

View File

@ -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;