summary refs log tree commit diff
path: root/conf.c
diff options
context:
space:
mode:
authorokan <okan>2012-12-17 23:03:41 +0000
committerokan <okan>2012-12-17 23:03:41 +0000
commit75f65f399e2cfc0fd73f6ae9f68e60313cfdd7e5 (patch)
tree6c0f8397fa8cf5e64d5cb2bf2bf22b9961a0c554 /conf.c
parentfe44d1dfce326c846fa199d6972ca77649176046 (diff)
downloadcwm-75f65f399e2cfc0fd73f6ae9f68e60313cfdd7e5.tar.gz
cwm-75f65f399e2cfc0fd73f6ae9f68e60313cfdd7e5.tar.xz
cwm-75f65f399e2cfc0fd73f6ae9f68e60313cfdd7e5.zip
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.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/conf.c b/conf.c
index 5d4ec23..9bdea9b 100644
--- a/conf.c
+++ b/conf.c
@@ -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;