simplify ARCH_group_name() by using lookup table as suggested by @learn_more. also added the missing group name for GRP_PRIVILEGE
diff --git a/utils.c b/utils.c
index d2f5fdc..ca2a7ec 100644
--- a/utils.c
+++ b/utils.c
@@ -52,6 +52,20 @@
return -1;
}
+char *id2name(name_map* map, int max, const unsigned int id)
+{
+ int i;
+
+ for (i = 0; i < max; i++) {
+ if (map[i].id == id) {
+ return map[i].name;
+ }
+ }
+
+ // nothing match
+ return NULL;
+}
+
// count number of positive members in a list.
// NOTE: list must be guaranteed to end in 0
unsigned int count_positive(uint16_t *list)