Skip to content

Commit

Permalink
Ensure we initialize thread IDs
Browse files Browse the repository at this point in the history
Signed-off-by: DL6ER <[email protected]>
  • Loading branch information
DL6ER committed Dec 9, 2024
1 parent 8de2a36 commit a05128b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/tools/dhcp-discover.c
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ int run_dhcp_discover(void)

// Get interface names for available interfaces on this machine
// and launch a thread for each one
pthread_t scanthread[2*MAXTHREADS];
pthread_t scanthread[2*MAXTHREADS] = { 0 };
pthread_attr_t attr;
// Initialize thread attributes object with default attribute values
pthread_attr_init(&attr);
Expand Down Expand Up @@ -832,8 +832,10 @@ int run_dhcp_discover(void)
// Wait for all threads to join back with us
for(tid--; tid > -1; tid--)
{
pthread_join(scanthread[tid], NULL);
pthread_join(scanthread[2*tid], NULL);
if(scanthread[tid] != 0)
pthread_join(scanthread[tid], NULL);
if(scanthread[2*tid] != 0)
pthread_join(scanthread[2*tid], NULL);
}

// Free linked-list of interfaces on this client
Expand Down

0 comments on commit a05128b

Please sign in to comment.