fix integer overflow and unhandled error

This commit is contained in:
ruti 2024-09-08 16:50:21 +03:00
parent 4f22ff6184
commit 663cbf8177
2 changed files with 4 additions and 4 deletions

View File

@ -68,7 +68,7 @@ struct buffer {
struct eval {
int fd;
int index;
unsigned int mod_iter;
unsigned long long mod_iter;
enum eid type;
struct eval *pair;
struct buffer buff;
@ -93,7 +93,7 @@ struct poolhd {
#else
struct pollfd *pevents;
#endif
unsigned int iters;
unsigned long long iters;
};
struct poolhd *init_pool(int count);

View File

@ -482,7 +482,7 @@ int udp_associate(struct poolhd *pool,
return -1;
}
struct eval *client = add_event(pool, EV_UDP_TUNNEL, cfd, POLLIN);
if (!pair) {
if (!client) {
del_event(pool, pair);
close(cfd);
return -1;
@ -880,7 +880,7 @@ int event_loop(int srvfd)
}
assert(val->type >= 0
&& val->type < sizeof(eid_name)/sizeof(*eid_name));
LOG(LOG_L, "new event: fd: %d, evt: %s, mod_iter: %d\n", val->fd, eid_name[val->type], val->mod_iter);
LOG(LOG_L, "new event: fd: %d, evt: %s, mod_iter: %llu\n", val->fd, eid_name[val->type], val->mod_iter);
switch (val->type) {
case EV_ACCEPT: