From 838c8723e314782c255011536126b95e9d6a97f9 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 24 Mar 2020 14:51:59 -0400 Subject: Add .circleci/config.yml --- lib/config_global.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'lib/config_global.c') diff --git a/lib/config_global.c b/lib/config_global.c index 16d97cf..f63566b 100644 --- a/lib/config_global.c +++ b/lib/config_global.c @@ -10,20 +10,16 @@ */ char *get_user_conf_dir(void) { char *result = NULL; - wordexp_t wexp; - wordexp("~/.spm", &wexp, 0); - if (wexp.we_wordc != 0) { - result = (char *)calloc(strlen(wexp.we_wordv[0]) + 1, sizeof(char)); - if (!result) { - wordfree(&wexp); - return NULL; - } - strncpy(result, wexp.we_wordv[0], strlen(wexp.we_wordv[0])); - if (access(result, F_OK) != 0) { - mkdirs(result, 0755); - } + + result = expandpath("~/.spm"); + if (result == NULL) { + perror("get_user_conf_dir"); + return NULL; + } + + if (access(result, F_OK) != 0) { + mkdirs(result, 0755); } - wordfree(&wexp); return result; } @@ -44,6 +40,7 @@ char *get_user_config_file(void) { sprintf(template, "%s%c%s", ucd, DIRSEP, filename); if (access(template, F_OK) != 0) { // No configuration exists, so fail + free(ucd); return NULL; } free(ucd); @@ -109,6 +106,7 @@ char *get_package_manifest(void) { if (manifest == NULL) { perror("manifest generator"); fprintf(SYSERROR); + free(ucd); return NULL; } manifest_write(manifest, PKG_DIR); -- cgit