diff options
author | okan | 2012-12-17 23:03:41 +0000 |
---|---|---|
committer | okan | 2012-12-17 23:03:41 +0000 |
commit | b5092167190004004d01ad01dd180ded079a0457 (patch) | |
tree | 214b6d5a085da7574ded5c0f27ea3b5f7a69fef9 /kbfunc.c | |
parent | 068d256bb7f3ff3381885ac9668d70d69271ac37 (diff) | |
download | cwm-b5092167190004004d01ad01dd180ded079a0457.tar.gz |
pull user home directory via getenv or getpwuid and stash it so we don't
need to do this everytime; with Tiago Cunha
Diffstat (limited to 'kbfunc.c')
-rw-r--r-- | kbfunc.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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 <sys/param.h> @@ -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; |