+2007-02-13 Guillem Jover <guillem@debian.org>
+
+ * src/archives.c (MAXCONFLICTORS): New macro.
+ (conflictor): Use MAXCONFLICTORS instad of hardcoded value '20', and
+ remove non-matching comments.
+ (check_conflict): Exit with an error instead of an assert. Move part
+ of the comment to the error message, remove the rest as non-matching.
+
2007-02-13 Guillem Jover <guillem@debian.org>
* dpkg-deb/build.c (getfi): Exit with an error instead of an assert.
* Check proper error value returned by BZ2_bzerror. Closes: #410605
* Exit with an error instead of an assert if a file name is too long when
building a .deb package. Closes: #393069
+ * Exit with an error instead of an assert if the number of conflictors is
+ exceeded. Remove bogus comments. Closes: #377855
[ Updated dpkg translations ]
* Romanian (Eddy Petrișor).
#include "main.h"
#include "archives.h"
-/* We shouldn't need anymore than 10 conflictors */
-struct pkginfo *conflictor[20];
+#define MAXCONFLICTORS 20
+
+struct pkginfo *conflictor[MAXCONFLICTORS];
int cflict_index = 0;
/* snprintf(3) doesn't work if format contains %.<nnn>s and an argument has
}
}
if (!pdep) {
- /* if this gets triggered, it means a package has > 10 conflicts/replaces
- * pairs, which is the package's fault
- */
- assert(cflict_index < (int)sizeof(conflictor));
+ if (cflict_index >= MAXCONFLICTORS)
+ ohshit(_("package %s has too many Conflicts/Replaces pairs"),
+ pkg->name);
+
/* This conflict is OK - we'll remove the conflictor. */
conflictor[cflict_index++]= fixbyrm;
varbuffree(&conflictwhy); varbuffree(&removalwhy);