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) (unidiff)
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)
750void 750void
751components_dump_depmap (void) 751components_dump_depmap (void)
752{ 752{
753 size_t i, j; 753 size_t i, j, k;
754 754
755 printf ("%s:\n", _("Dependency map")); 755 printf ("%s:\n", _("Dependency map"));
756 printf (" "); 756 printf (" ");
757 for (i = 0; i < comp_count; i++) 757 for (i = k = 0; i < comp_count; i++)
758 printf (" %2lu", (unsigned long)i); 758 if (comp_array[i])
759 {
760 printf (" %2lu", (unsigned long)k);
761 k++;
762 }
759 printf ("\n"); 763 printf ("\n");
760 for (i = 0; i < comp_count; i++) 764 for (i = k = 0; i < comp_count; i++)
761 { 765 {
762 printf ("%2lu ", (unsigned long)i); 766 if (comp_array[i])
763 for (j = 0; j < comp_count; j++) 767 {
764 printf (" %c ", depmap_isset (depmap, i, j) ? 'X' : ' '); 768 printf ("%2lu ", (unsigned long)k);
765 printf ("\n"); 769 for (j = 0; j < comp_count; j++)
770 if (comp_array[j])
771 printf (" %c ", depmap_isset (depmap, i, j) ? 'X' : ' ');
772 printf ("\n");
773 k++;
774 }
766 } 775 }
767 printf ("\n%s:\n", _("Legend")); 776 printf ("\n%s:\n", _("Legend"));
768 for (i = 0; i < comp_count; i++) 777 for (i = 0; i < comp_count; i++)

Return to:

Send suggestions and report system problems to the System administrator.