Step 0: pkgtools/pkg_install

* Add anti-recursivity checks when computing package dependancy,
   (Original author Thomas Cort)
This commit is contained in:
2013-10-08 13:15:25 +02:00
committed by Lionel Sambuc
parent c94e9e0e1c
commit d311f12f14
3 changed files with 102 additions and 7 deletions

View File

@@ -514,6 +514,7 @@ delete_package(Boolean ign_err, package_t *pkg, Boolean NoDeleteFiles,
int fail = SUCCESS;
Boolean preserve;
char tmp[MaxPathSize];
char cmd[MaxPathSize];
const char *prefix = NULL, *name = NULL;
if (!pkgdb_open(ReadWrite)) {
@@ -580,10 +581,12 @@ delete_package(Boolean ign_err, package_t *pkg, Boolean NoDeleteFiles,
case PLIST_UNEXEC:
if (NoDeleteFiles)
break;
format_cmd(tmp, sizeof(tmp), p->name, prefix, last_file);
printf("Executing `%s'\n", tmp);
if (!Fake && system(tmp)) {
warnx("unexec command for `%s' failed", tmp);
(void) snprintf(tmp, sizeof(tmp), "%s%s%s",
destdir ? destdir : "", destdir ? "/" : "", prefix);
format_cmd(cmd, sizeof(cmd), p->name, tmp, last_file);
printf("Executing `%s'\n", cmd);
if (!Fake && system(cmd)) {
warnx("unexec command for `%s' failed", cmd);
fail = FAIL;
}
break;