mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-26 22:48:19 +00:00
dispatcher: Define pollfd variable only if needed
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe de Dinechin <dinechin@redhat.com>
This commit is contained in:
parent
9663ae6785
commit
d701fac78f
@ -190,13 +190,13 @@ static int read_safe(int fd, uint8_t *buf, size_t size, int block)
|
||||
{
|
||||
int read_size = 0;
|
||||
int ret;
|
||||
struct pollfd pollfd = {.fd = fd, .events = POLLIN, .revents = 0};
|
||||
|
||||
if (size == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!block) {
|
||||
struct pollfd pollfd = {.fd = fd, .events = POLLIN, .revents = 0};
|
||||
while ((ret = poll(&pollfd, 1, 0)) == -1) {
|
||||
if (errno == EINTR) {
|
||||
spice_debug("EINTR in poll");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user