diff --git a/src/chat/config.c b/src/chat/config.c index d078f60..ac0ebd9 100644 --- a/src/chat/config.c +++ b/src/chat/config.c @@ -35,15 +35,16 @@ along with this program. If not, see . void init_config(char *filename) { struct stat st; + char *buffer = why2_replace(WHY2_CONFIG_DIR, "{USER}", getenv("USER")); //CREATE USER CONFIG FOLDER [THIS SHOULDN'T HAPPEN ON CLIENT, BUT IT'S NEEDED ON FRESH SERVERS] - if (stat(WHY2_CONFIG_DIR, &st) == -1) + if (stat(buffer, &st) == -1) { - mkdir(WHY2_CONFIG_DIR, 0700); + mkdir(buffer, 0700); } //GET THE CONFIG TYPE - char *buffer = why2_malloc(strlen(WHY2_CHAT_CONFIG_DIR) + strlen(filename) + 2); + buffer = why2_realloc(buffer, strlen(WHY2_CHAT_CONFIG_DIR) + strlen(filename) + 2); sprintf(buffer, "%s/%s", WHY2_CHAT_CONFIG_DIR, filename); char *path = why2_replace(buffer, "{USER}", getenv("USER"));