Skip to content

Commit

Permalink
fix(kmod): fix is_subscriber_referencing bug
Browse files Browse the repository at this point in the history
Signed-off-by: veqcc <ryuta.kambe@tier4.jp>
  • Loading branch information
veqcc committed Feb 7, 2025
1 parent 5ab3119 commit b1c02ae
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kmod/agnocast.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ static struct publisher_info * insert_publisher_info(

static bool is_subscriber_referencing(struct entry_node * en)
{
// Since referencing_subscriber_ids always stores entries in order from the lowest index,
// if there's nothing at index 0, it means it doesn't exist.
return (en->referencing_subscriber_ids[0] > 0);
// The referencing_subscriber_ids array is always populated starting from the smallest index.
// Therefore, an empty element at index 0 is equivalent to a non-existent referencing subscriber.
return (en->referencing_subscriber_ids[0] != -1);
}

static void remove_referencing_subscriber_by_index(struct entry_node * en, int index)
Expand Down

0 comments on commit b1c02ae

Please sign in to comment.