about summary refs log tree commit diff
path: root/conf.c
diff options
context:
space:
mode:
authorokan <okan>2012-10-31 22:06:24 +0000
committerokan <okan>2012-10-31 22:06:24 +0000
commit620af2e52d71d3df86c5da594a3f70f3c263b344 (patch)
tree051bd24f2ddb98f67681f34b1dbdfcbe2a8e352d /conf.c
parent4fb420514d73699acfc7ec1c35124cf7819a277f (diff)
downloadcwm-620af2e52d71d3df86c5da594a3f70f3c263b344.tar.gz
cwm-620af2e52d71d3df86c5da594a3f70f3c263b344.tar.xz
cwm-620af2e52d71d3df86c5da594a3f70f3c263b344.zip
no longer a reason to carry conf_path in struct conf, so dice.
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/conf.c b/conf.c
index 0be8fb3..57e45a2 100644
--- a/conf.c
+++ b/conf.c
@@ -237,6 +237,7 @@ conf_clear(struct conf *c)
 void
 conf_setup(struct conf *c, const char *conf_file)
 {
+	char		 conf_path[MAXPATHLEN];
 	char		*home;
 	struct stat	 sb;
 	int		 parse = 0;
@@ -247,23 +248,22 @@ conf_setup(struct conf *c, const char *conf_file)
 		if ((home = getenv("HOME")) == NULL)
 			errx(1, "No HOME directory.");
 
-		(void)snprintf(c->conf_path, sizeof(c->conf_path), "%s/%s",
+		(void)snprintf(conf_path, sizeof(conf_path), "%s/%s",
 		    home, CONFFILE);
 
-		if (stat(c->conf_path, &sb) == 0 && (sb.st_mode & S_IFREG))
+		if (stat(conf_path, &sb) == 0 && (sb.st_mode & S_IFREG))
 			parse = 1;
 	} else {
 		if (stat(conf_file, &sb) == -1 || !(sb.st_mode & S_IFREG))
 			errx(1, "%s: %s", conf_file, strerror(errno));
 		else {
-			(void)strlcpy(c->conf_path, conf_file,
-			    sizeof(c->conf_path));
+			(void)strlcpy(conf_path, conf_file, sizeof(conf_path));
 			parse = 1;
 		}
 	}
 
-	if (parse && (parse_config(c->conf_path, c) == -1))
-		warnx("config file %s has errors, not loading", c->conf_path);
+	if (parse && (parse_config(conf_path, c) == -1))
+		warnx("config file %s has errors, not loading", conf_path);
 }
 
 void