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 --- conf.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'conf.c') diff --git a/conf.c b/conf.c index 2b7fded..b31a32c 100644 --- a/conf.c +++ b/conf.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: conf.c,v 1.112 2012/12/17 02:53:29 okan Exp $ + * $OpenBSD: conf.c,v 1.113 2012/12/17 23:03:41 okan Exp $ */ #include @@ -243,18 +243,14 @@ void conf_setup(struct conf *c, const char *conf_file) { char conf_path[MAXPATHLEN]; - char *home; struct stat sb; int parse = 0; conf_init(c); if (conf_file == NULL) { - if ((home = getenv("HOME")) == NULL) - errx(1, "No HOME directory."); - (void)snprintf(conf_path, sizeof(conf_path), "%s/%s", - home, CONFFILE); + homedir, CONFFILE); if (stat(conf_path, &sb) == 0 && (sb.st_mode & S_IFREG)) parse = 1; -- cgit v1.2.3-2-gb3c3