mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
pull user home directory via getenv or getpwuid and stash it so we don't
need to do this everytime; with Tiago Cunha
This commit is contained in:
6
conf.c
6
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;
|
||||
|
Reference in New Issue
Block a user