[Spice-devel] [PATCH spice-server] dispatcher: Define pollfd variable only if needed
Frediano Ziglio
fziglio at redhat.com
Mon Jun 25 10:46:21 UTC 2018
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
server/dispatcher.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/server/dispatcher.c b/server/dispatcher.c
index 301feffd..3e0decde 100644
--- a/server/dispatcher.c
+++ b/server/dispatcher.c
@@ -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");
--
2.17.1
More information about the Spice-devel
mailing list