Skip to content

Commit c41b76a

Browse files
committed
auplugin: join feed worker before returning
auplugin_event_feed detached the outbound feed thread and returned after inbound shutdown, allowing callers to free shared state while callbacks could still be running. Fixed auplugin_event_feed by removing pthread_detach(outbound_thread) and synchronizing shutdown with pthread_join(outbound_thread, NULL) before returning. This ensures callback processing is finished before caller teardown starts, preventing any shutdown races.
1 parent 6e440a8 commit c41b76a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

auplugin/auplugin.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,9 +213,15 @@ int auplugin_event_feed(auparse_callback_ptr callback, unsigned int t_interval,
213213

214214
return -1;
215215
}
216-
pthread_detach(outbound_thread);
217216

218217
common_inbound();
218+
219+
rc = pthread_join(outbound_thread, NULL);
220+
if (rc) {
221+
syslog(LOG_ERR, "pthread_join failed: %d", rc);
222+
return -1;
223+
}
224+
219225
return 0;
220226
}
221227

@@ -343,4 +349,3 @@ int auplugin_queue_overflow(void)
343349
{
344350
return queue_overflowed_p();
345351
}
346-

0 commit comments

Comments
 (0)