aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2013-09-04 21:30:28 +0200
committerAndreas Steffen <andreas.steffen@strongswan.org>2013-09-04 21:30:36 +0200
commitbd3eaaef9b0cc0d1bd74a987bcb95d3942b146bb (patch)
tree9df00a1703c7f91239fe0f6723d25a6e03d528be
parentcee1a863851ad3c6b39ee93ef8787682fcfc73e5 (diff)
downloadstrongswan-bd3eaaef9b0cc0d1bd74a987bcb95d3942b146bb.tar.bz2
strongswan-bd3eaaef9b0cc0d1bd74a987bcb95d3942b146bb.tar.xz
Count collected SWID tags or tag IDs
-rw-r--r--src/libpts/swid/swid_inventory.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/libpts/swid/swid_inventory.c b/src/libpts/swid/swid_inventory.c
index 642b65609..239ea9f92 100644
--- a/src/libpts/swid/swid_inventory.c
+++ b/src/libpts/swid/swid_inventory.c
@@ -54,7 +54,8 @@ struct private_swid_inventory_t {
linked_list_t *list;
};
-static bool collect_tags(private_swid_inventory_t *this, char *pathname)
+static bool collect_tags(private_swid_inventory_t *this, char *pathname,
+ int *tag_count)
{
char *rel_name, *abs_name;
struct stat st;
@@ -82,7 +83,7 @@ static bool collect_tags(private_swid_inventory_t *this, char *pathname)
}
if (S_ISDIR(st.st_mode))
{
- if (!collect_tags(this, abs_name))
+ if (!collect_tags(this, abs_name, tag_count))
{
goto end;
}
@@ -167,6 +168,8 @@ static bool collect_tags(private_swid_inventory_t *this, char *pathname)
tag_id = swid_tag_id_create(tag_creator, unique_sw_id, unique_seq_id);
this->list->insert_last(this->list, tag_id);
}
+ (*tag_count)++;
+
}
success = TRUE;
@@ -180,7 +183,18 @@ end:
METHOD(swid_inventory_t, collect, bool,
private_swid_inventory_t *this)
{
- return collect_tags(this, SWID_TAG_DIRECTORY);
+ int tag_count = 0;
+
+ if (collect_tags(this, SWID_TAG_DIRECTORY, &tag_count))
+ {
+ DBG1(DBG_IMC, "collected %d SWID tag%s%s", tag_count,
+ this->full_tags ? "" : " ID", (tag_count == 1) ? "" : "s");
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
}
METHOD(swid_inventory_t, add, void,