libopkg: suppress empty provides
authorJo-Philipp Wich <jo@mein.io>
Fri, 10 Feb 2017 09:29:44 +0000 (10:29 +0100)
committerJo-Philipp Wich <jo@mein.io>
Fri, 10 Feb 2017 09:29:44 +0000 (10:29 +0100)
When writing out status information, suppress the Provides field if there
are no providers.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
libopkg/pkg.c

index 265f5541f37c8f98904e2b58f50a3cbea768330c..64ee70a00c401244e8a8e7c1d0c06a2a142d1250 100644 (file)
@@ -731,7 +731,7 @@ pkg_formatted_field(FILE *fp, pkg_t *pkg, const char *field)
          } else if (strcasecmp(field, "Priority") == 0) {
                fprintf(fp, "Priority: %s\n", pkg->priority);
          } else if (strcasecmp(field, "Provides") == 0) {
-              if (pkg->provides_count) {
+              if (pkg->provides_count > 1) {
                   fprintf(fp, "Provides:");
                  for(i = 1; i < pkg->provides_count; i++) {
                       fprintf(fp, "%s %s", i == 1 ? "" : ",",