[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 3/3] Do not disturb old fd flags (eg O_APPEND) when
From: |
Ian Jackson |
Subject: |
[Qemu-devel] [PATCH 3/3] Do not disturb old fd flags (eg O_APPEND) when setting nonblock. |
Date: |
Fri, 18 Jul 2008 14:28:52 +0100 |
socket_set_nonblock should not unconditionally call
fcntl(,F_SETFL,O_NONBLOCK) because that would clear other flags which
might be intentionally set on the fd.
Signed-off-by: Ian Jackson <address@hidden>
---
vl.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/vl.c b/vl.c
index c428c7e..0fb9c17 100644
--- a/vl.c
+++ b/vl.c
@@ -2005,7 +2005,9 @@ static inline int send_all(int fd, const uint8_t *buf,
int len1)
void socket_set_nonblock(int fd)
{
- fcntl(fd, F_SETFL, O_NONBLOCK);
+ int f;
+ f = fcntl(fd, F_GETFL);
+ fcntl(fd, F_SETFL, f | O_NONBLOCK);
}
#endif /* !_WIN32 */
--
1.4.4.4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [PATCH 3/3] Do not disturb old fd flags (eg O_APPEND) when setting nonblock.,
Ian Jackson <=