aboutsummaryrefslogtreecommitdiffstats
path: root/conf.c
diff options
context:
space:
mode:
authorokan2012-12-17 23:03:41 +0000
committerokan2012-12-17 23:03:41 +0000
commitb5092167190004004d01ad01dd180ded079a0457 (patch)
tree214b6d5a085da7574ded5c0f27ea3b5f7a69fef9 /conf.c
parent068d256bb7f3ff3381885ac9668d70d69271ac37 (diff)
downloadcwm-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 '')
-rw-r--r--conf.c8
1 files changed, 2 insertions, 6 deletions
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 <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;