monitor: Fix return type of monitor_fdset_dup_fd_find

monitor_fdset_dup_fd_find_remove() and monitor_fdset_dup_fd_find()
return mon_fdset->id which is int64_t. Downcasting from int64_t to int
leads to a bug with removing fd from fdset with id >= 2^32.
So, fix return types for these function.

Signed-off-by: Yury Kotov <yury-kotov@yandex-team.ru>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190523094433.30297-1-yury-kotov@yandex-team.ru>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
Yury Kotov 2019-05-23 12:44:33 +03:00 committed by Markus Armbruster
parent 076243ffe6
commit 854f63d440
3 changed files with 4 additions and 4 deletions

View File

@ -44,6 +44,6 @@ AddfdInfo *monitor_fdset_add_fd(int fd, bool has_fdset_id, int64_t fdset_id,
int monitor_fdset_get_fd(int64_t fdset_id, int flags);
int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd);
void monitor_fdset_dup_fd_remove(int dup_fd);
int monitor_fdset_dup_fd_find(int dup_fd);
int64_t monitor_fdset_dup_fd_find(int dup_fd);
#endif /* MONITOR_H */

View File

@ -2604,7 +2604,7 @@ err:
return -1;
}
static int monitor_fdset_dup_fd_find_remove(int dup_fd, bool remove)
static int64_t monitor_fdset_dup_fd_find_remove(int dup_fd, bool remove)
{
MonFdset *mon_fdset;
MonFdsetFd *mon_fdset_fd_dup;
@ -2632,7 +2632,7 @@ err:
return -1;
}
int monitor_fdset_dup_fd_find(int dup_fd)
int64_t monitor_fdset_dup_fd_find(int dup_fd)
{
return monitor_fdset_dup_fd_find_remove(dup_fd, false);
}

View File

@ -6,7 +6,7 @@ int monitor_fdset_dup_fd_add(int64_t fdset_id, int dup_fd)
return -1;
}
int monitor_fdset_dup_fd_find(int dup_fd)
int64_t monitor_fdset_dup_fd_find(int dup_fd)
{
return -1;
}