diff --git a/slirp_glue/glib_qemu_stubs.c b/slirp_glue/glib_qemu_stubs.c index fd6030c8..a36bd4b5 100644 --- a/slirp_glue/glib_qemu_stubs.c +++ b/slirp_glue/glib_qemu_stubs.c @@ -151,8 +151,10 @@ unsigned long non_block = 1; void qemu_set_nonblock(int fd) { int f; + f = fcntl(fd, F_GETFL); - fcntl(fd, F_SETFL, f | O_NONBLOCK); + if (f!= -1) + fcntl(fd, F_SETFL, f | O_NONBLOCK); } #endif