diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-04-18 15:28:54 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-04-19 00:32:26 -0400 |
commit | 8cdddbb0f1a8c6eb023cbe732e5701240a54ff3c (patch) | |
tree | 12cc1ea0186b242a82d87bc2f62142e5decefedb /lib/config_global.c | |
parent | f70b803e39484a2eba362414545ba8afd027c9da (diff) | |
download | spmc-8cdddbb0f1a8c6eb023cbe732e5701240a54ff3c.tar.gz |
Implement error handling
* Die on bad root directory
Diffstat (limited to 'lib/config_global.c')
-rw-r--r-- | lib/config_global.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/config_global.c b/lib/config_global.c index f63566b..e97cddb 100644 --- a/lib/config_global.c +++ b/lib/config_global.c @@ -153,7 +153,7 @@ void check_runtime_environment(void) { } /** - * + * Define the structure of a SPM root hierarchy * @param basepath * @return */ @@ -170,12 +170,13 @@ SPM_Hierarchy *spm_hierarchy_init(char *basepath) { fs->tmpdir = join((char *[]) {fs->rootdir, "tmp", NULL}, DIRSEPS); fs->dbdir = join((char *[]) {fs->localstatedir, "db", NULL}, DIRSEPS); fs->dbrecdir = join((char *[]) {fs->dbdir, "records", NULL}, DIRSEPS); + fs->rootrec = join((char *[]) {".spm_root", NULL}, DIRSEPS); return fs; } /** - * + * Free SPM_Hierarchy structure * @param fs */ void spm_hierarchy_free(SPM_Hierarchy *fs) { @@ -190,6 +191,7 @@ void spm_hierarchy_free(SPM_Hierarchy *fs) { free(fs->tmpdir); free(fs->dbdir); free(fs->dbrecdir); + free(fs->rootrec); free(fs); } |