mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
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:
7
kbfunc.c
7
kbfunc.c
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user