Apropos nothing, but ISTM that i, path_count and state->fsevent_handle_count should be unsigned rather than signed.  There is no legitimate reason for those last two to ever be < 0, right?