summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2019-05-17 17:31:40 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2019-05-17 17:31:40 (GMT)
commita3240e8cdde7d311cf006217d894a00398d4f130 (patch) (side-by-side diff)
tree7c75dd65791c94672c5cde56fb98ee99a4f7b8c5
parent14e5c1c34e65d5534e326292152a8d64f97b3f54 (diff)
downloadpies-a3240e8cdde7d311cf006217d894a00398d4f130.tar.gz
pies-a3240e8cdde7d311cf006217d894a00398d4f130.tar.bz2
Fix coredump in components_dump_depmap
Coredump was triggered by detected cyclic dependency.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/comp.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/comp.c b/src/comp.c
index 7eb8479..17832ad 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -750,19 +750,28 @@ component_get (size_t n)
void
components_dump_depmap (void)
{
- size_t i, j;
+ size_t i, j, k;
printf ("%s:\n", _("Dependency map"));
printf (" ");
- for (i = 0; i < comp_count; i++)
- printf (" %2lu", (unsigned long)i);
+ for (i = k = 0; i < comp_count; i++)
+ if (comp_array[i])
+ {
+ printf (" %2lu", (unsigned long)k);
+ k++;
+ }
printf ("\n");
- for (i = 0; i < comp_count; i++)
+ for (i = k = 0; i < comp_count; i++)
{
- printf ("%2lu ", (unsigned long)i);
- for (j = 0; j < comp_count; j++)
- printf (" %c ", depmap_isset (depmap, i, j) ? 'X' : ' ');
- printf ("\n");
+ if (comp_array[i])
+ {
+ printf ("%2lu ", (unsigned long)k);
+ for (j = 0; j < comp_count; j++)
+ if (comp_array[j])
+ printf (" %c ", depmap_isset (depmap, i, j) ? 'X' : ' ');
+ printf ("\n");
+ k++;
+ }
}
printf ("\n%s:\n", _("Legend"));
for (i = 0; i < comp_count; i++)

Return to:

Send suggestions and report system problems to the System administrator.