- int rc = 0;
-
- switch (event->type) {
- case EVENT_TYPE_UDEV:
- switch (event->action) {
- case EVENT_ACTION_ADD:
- rc = handle_add_udev_event(handler, event);
- break;
- case EVENT_ACTION_REMOVE:
- rc = handle_remove_udev_event(handler, event);
- break;
- default:
- pb_log("%s unknown action: %d\n", __func__,
- event->action);
- break;
- }
- break;
- case EVENT_TYPE_USER:
- switch (event->action) {
- case EVENT_ACTION_ADD:
- rc = handle_add_user_event(handler, event);
- break;
- case EVENT_ACTION_REMOVE:
- rc = handle_remove_user_event(handler, event);
- break;
- default:
- pb_log("%s unknown action: %d\n", __func__,
- event->action);
- break;
- }
- break;
- default:
- pb_log("%s unknown type: %d\n", __func__, event->type);
- break;
+ if (event->type >= EVENT_TYPE_MAX ||
+ event->action >= EVENT_ACTION_MAX ||
+ !handlers[event->type][event->action]) {
+ pb_log("%s unknown type/action: %d/%d\n", __func__,
+ event->type, event->action);
+ return 0;