diff options
author | Joseph Hunkeler <jhunkeler@users.noreply.github.com> | 2020-05-26 14:43:00 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-26 14:43:00 -0400 |
commit | df0686fb8b6fefebda0548d39caad2622e2bce89 (patch) | |
tree | cbd2d92667a0ab45221a220948f6ee33b2926a1c /lib/install.c | |
parent | c205840e737b23614a686a9675b896106cee5c64 (diff) | |
parent | 065d39bff58c02719abf5a710b22d8355ff1b19d (diff) | |
download | spmc-df0686fb8b6fefebda0548d39caad2622e2bce89.tar.gz |
Merge pull request #38 from jhunkeler/from-file
From file
Diffstat (limited to 'lib/install.c')
-rw-r--r-- | lib/install.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/install.c b/lib/install.c index 9fb80c2..282c662 100644 --- a/lib/install.c +++ b/lib/install.c @@ -201,16 +201,24 @@ int spm_do_install(SPM_Hierarchy *fs, ManifestList *mf, StrList *packages) { ManifestPackage **requirements = NULL; char source[PATH_MAX]; char *tmpdir = NULL; + size_t package_count; + + package_count = strlist_count(packages); + if (package_count == 0) { + spmerrno = SPM_ERR_PKG_NOT_FOUND; + spmerrno_cause("EMPTY PACKAGE LIST"); + return -1; + } // Produce a dependency tree from requested package(s) - for (size_t i = 0; i < strlist_count(packages); i++) { + for (size_t i = 0; i < package_count; i++) { char *item = strlist_item(packages, i); // Does the package exist in the manifest? if (manifestlist_search(mf, item) == NULL) { spmerrno = SPM_ERR_PKG_NOT_FOUND; spmerrno_cause(item); - break; + return -1; } requirements = resolve_dependencies(mf, item); @@ -221,10 +229,6 @@ int spm_do_install(SPM_Hierarchy *fs, ManifestList *mf, StrList *packages) { } } - if (spmerrno) { - return -1; - } - tmpdir = spm_mkdtemp(TMP_DIR, "spm_destroot", NULL); if (tmpdir == NULL) { perror("Could not create temporary destination root"); |