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 /conf.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 'conf.c')
-rw-r--r-- | conf.c | 8 |
1 files changed, 2 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: 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 <sys/param.h> @@ -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; |